.net

Are .NET delegates used for events?

I'm little confused, I know that delegates are like function pointers, and they are used to pass a function as a parameter into a method. How does that fit into the event model? Calling: myButton.OnClick += new .....(); Is that internally just passing the method/function as a parameter when the event occurs and all the subscribers a...

Why are my Validation Rules not being run when DataContext is set?

I have the following Loaded event on my Window: void Window_Loaded(object sender, RoutedEventArgs e) { this.DataContext = new MyObject() { MyDateTime = DateTime.Now, MyNotEmptyString = "Not Empty", MyNotUpperCaseString = "not upper case", MyInteger = 20, MyIntegerInRange = 1, MyDouble ...

How should I determine a database column type in an agnostic way using DbConnection.GetSchema?

I want to allow the user to define a query which will be used to fetch some information. The database the user connects to is also user definable. Basically the steps that the user needs to perform are: 1/ Select the data provider (this is one of the providers returned by DbProviderFactories.GetFactoryClasses ()) 2/ Configure the sel...

How can I force all derived classes to implement an abstract method or property?

An abstract function must be implemented by all concrete classes. Sometimes you want to force all derivative classes to implement the abstract function, even derivatives of concrete classes. class Base { protected abstract Base Clone(); } class Concrete : Base { protected override Base Clone(){...}; } class Custom : Concrete {} I wou...

Confusion about where to store Application Settings in .NET Win apps

I need to know where and how application settings (connections string) could be stored so that they can be changed at run time and saved. I know in VS you can configure settings under Project>Properties and these get stored in the appname.exe.config file under apps install directory.But the "application scope" ones are not read/write at...

Code version control when developing in .NET/SQL Server 2005 on a Mac

I recently started a new job where the office environment is Mac-based, but I will be developing in .NET and SQL Server. I'm already pretty sold on installing VMWare Fusion to set up a virtual XP box, but I'm wondering if anyone would be able to recommend a solution for code version control. Specifically, should I be installing somethi...

C# - Correct Way to Load Assembly, Find Class and Call Run() Method

Sample console program. class Program { static void Main(string[] args) { // ... code to build dll ... not written yet ... Assembly assembly = Assembly.LoadFile(@"C:\dyn.dll"); // don't know what or how to cast here // looking for a better way to do next 3 lines IRunnable r = assembly.Crea...

Equivallent of .NET's WebClient and HttpWebRequest in Java?

.NET has HttpWebRequest and WebClient for simulating a browser's requests. I'd google it, but I'm not sure what keyword to use. I want to write code that does does HTTP GETs and POSTs, along with cookies, in an applet or local jar and gives me back the response in a text string or some other parseable structure. ...

get postback trigger

Is it possible to get button id that triggered postback in Page_Load void? Tanks ...

How to do an "in" query in entity framework?

How can I do a select in linq to entities to select rows with keys from a list? Something like this: var orderKeys = new int[] { 1, 12, 306, 284, 50047}; var orders = (from order in context.Orders where (order.Key in orderKeys) select order).ToList(); Assert.AreEqual(orderKeys.Count, orders.Count); I tri...

Reporting Services with Visual Studio 2008

I am new to the Reporting Services provided within Visual Studio 2008. I have created a matrix report with the data I want but would like to create Pie charts based on each row of the matrix. Is this possible? ...

Uploading Files with WebServices hosted on IIS--> Best Practises

hi There, We have an application for which UI is built on Flex, and its consuming webservieces built on Dotnet hosted on IIS. we are trying to upload files which are around 100/200 megs , this works like a charm on LAN , if we try to do the same with web service hosted on public ip machines , then this would fail very often(obviously bc...

Where do you put the function documentation so that it shows up on intellisense?

I'm writing a library and I want to put documentation in my functions so that it will show up in intellisense, kind of like how the intellisense for the built in functions shows descriptions for each of the parameters and for the function itself. How do you put the documentation in? Is it through comments in the function or is it in some...

C#.Net Getting Last day of the Previous Month from current date

A quick expression anyone please? ...

decimal formatting without rounding .net

Yesterday I asked this general question about decimals and their internal precisions. Here is a specific question about the scenario I'm trying to address. I have column in SqlServer that is typed - decimal(18,6). When I fetch these values, the .net decimals that are created match the precision in the database. They look like this: 1...

Can I dynamically switch between styles in WPF?

Let's say I wanted to display a Button and a few RadioButtons. Based on which RadioButton is selected, I want to apply a different style to my Button. Is this possible in WPF? ...

XNA on iPhone

I don't know if it's a strange question but how could I run a game made with XNA on the iPhone/iTouch ? Which steps/tools (existing ones or imaginary...) should be used ? note: The goal is to avoid modifying existing C# code UPDATE : If I understand correctly, I must be able to: 1) Run my XNA code on Mono (monoxna or SilverSprit...

Where can I find a 'Requires .net 3.5' logo?

I once found a web site that had some 'Requires .net 1.0', 'Requires .net 2.0' logos for use on web sites etc, does anyone know the name of the site or where I can get something similar? Thanks ...

Convert .NET DateTimeFormatInfo to Javascript jQuery formatDate?

I hava a jQuery UI datepicker which I intend to use with a textbox in ASP.NET MVC. The date-display in the textbox is localized via CultureInfo and of course should be recognized by jquery to select the correct date in the datepicker: <%= Html.TextBox("Date", Model.Date.ToString("d", currentCultureInfo), new { @class = "datepicker" ...

TimeSpan to friendly string library (C#)

Duplicate: This is one of the earliest question on StackOverflow posted by Jeff. http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time Does anyone know of a good library (or code snippet) for converting a TimeSpan object to a "friendly" string such as: Two years, three months and four days One week and two days (...