.net

Is there a way to take an XmlNode and display its data in a datagrid view?

I have spent about half a day searching for an answer to this question and am slowly becoming frustrated. I am working with a Web service that returns an XmlNode as its response. I would like to be able to take the XML data reference by the node and view it with a data grid view. Does any one know if this is possible? I am using the fo...

Inconsistency in WMI Win32_NetworkAdapter class (AdapterTypeId property)

So I am exploring a Win 2008 Server machine with WMI queries on the Win32_NetworkAdapter class. This class is documented here: http://msdn.microsoft.com/en-us/library/aa394216(VS.85).aspx Here's what it says about the possible values of that property. There's also an AdapterType property that returns the same information, only in the fo...

Value assignment for reference type in C#

What is the proper way to implement assignment by value for a reference type? I want to perform an assignment, but not change the reference. Here is what I'm talking about: void Main() { A a1 = new A(1); A a2 = new A(2); a1 = a2; //WRONG: Changes reference a1.ValueAssign(a2); //This works, but is it the best way? } cl...

XmlSerializer with parameterless constructor with no public properties or fields... Is it possible?

Having the following class (.Net 3.5): public class Something { public string Text {get; private set;} private Something() { Text = string.Empty; } public Something(string text) { Text = text; } } This serializes without error but the resulting XML does not include the Text property since ...

Flow Chart to model inspection process in .NET winform application

We're writing a .NET winform application and I'm looking for options on one of the features. The end user for this system will be defining inspection processes which need to be easy to follow and will be used to show inspectors their options when inspecting a product as well as to drive the inspection module on which questions need to b...

Problem with .Net Remoting (C#)

I am using .Net Remoting and trying to access a remote object modified in the Server, here is the object def: The idea is that the MRB object, which I create on the server, is returned to the client and "Set On Server" is printed out when getString() is called on the client. What I get right now is a null string on the client, so the M...

Why not make everything 'virtual' ?

Possible Duplicate: Why C# implements methods as non-virtual by default? I'm speaking primarily about C#, .NET 3.5, but wonder in general what the benefits are of not considering everything "virtual" - which is to say that a method called in an instance of a child class always executes the child-most version of that method. In ...

How can I validate a property against a regular expresssion and still allow it to be null or empty?

I'm using the Validation Application Block from Microsoft. I have a string property which holds a phone number. I have a RegexValidator on it which works pretty well for ensuring only phone number type strings are in the property, but the property should also allow values that are null or an empty string. Currently the this validator ...

Are all .Net Obfuscators equal in speed terms?

I currently use the free obfuscation tool that ships with VS and it does what I need but my program seems slower after obfuscation, are other ofuscators any better? Thanks ...

Why Microsoft .NET Framework Client Profile is 256 MB?

Microsoft .NET Framework Client Profile Offline Installer - 255.6 MB. Shouldn't it be 27MB or so? Here list of biggest files within package (size in bytes). dotnetfx35.exe (242 743 296) DotNetFx20Client_Package_x86.exe (14 466 600) DotNetFx30Client_Package_x86.exe (8 328 232) DotNetFx35Client_Package_x86.exe (935 976) So may be r...

How to implement Auto-Complete with a StandardValuesCollection on a PropertyGrid

I have a property on an object whose custom TypeConverter specifies an exclusive StandardValuesCollection (let's say "Foo" and "Bar"), so that when editing this property via a PropertyGrid, a drop-down list of these values is displayed. I would also like to be able to directly type in the field on the PropertyGrid, and have it auto-comp...

Class Array with [] and IEnumerable

I created a class that's something like this: public class MovieTheaterList { public DateTime Date { get; private set; } public int NumTheaters { get; private set; } public Theater[] Theaters { get; private set; } } public class Theater { public string Name; } I want to be able ...

Example of a winforms app implemented as a wpf app?

I'm trying to learn more about WPF and I've read a bit about Model-View-ViewModel (MVVM) but if I were to create a WPF app I think I would still do things, out of habit, the same way I did in winforms. Which from my understand is going to eventually code me into a corner. So to one way for me to learn the 'right' way is to compare and ...

How do I copy a folder and all subfolders and files in .NET?

I'd like to copy folder with all its subfolders and file from one location to another in .NET. What's the best way to do this? I see the Copy method on the System.IO.File class, but was wondering whether there was an easier, better, or faster way than to crawl the directory tree. ...

Why should I always make my Exceptions [serializable]? (.NET)

Referring to What is the correct way to make a custom .NET Exception serializable? and Are all .NET Exceptions serializable? ... Why should my exceptions be serializable? Someone said "it can be considered a bug" if a custom exception defined by a third party library, is not serializable. Why? Why are exceptions different than oth...

WPF Databinding Calculated Value sometimes minutes sometimes hours

I have a WPF window with a textbox, using standard WPF Databinding to an object. This all works fine, the issue is this: The user is entering a time estimate, I would like to give the user the option to enter the data in hours or minutes (through a drop down list). I'd like to keep the data in minutes, and if the user selects hours, mul...

Linq Not Retrieving Correct Items in a Big Table

I'm with a very strange problem. I've a table with more than 800.000 records and 2GB mdf Database. When I try to get the last records: I'm only getting the records until one month ago, the last ones doesn't show up. Dim Items = From Item In DB.Items _ Where Item.CatID = CatID _ Order By Item.PubDate Descending ...

Does anybody write desktop apps using .NET?

I honsetly can't say that I have ever seen a commercial app that uses .NET (other then controls for devs/open source). With it being so easy to 'decompile' a .NET application using RedGates .NET Reflector, I was wondering if .NET was geared toward ASP.NET (since you can't 'decompile' because the code runs on a server and is not stored on...

How do I associate a custom default build action to a custom file type in Visual Studio?

I have a language service that I have built for a custom file type. In addition, I have created a custom target (build action) within my MSBuild project files. I am however unable to find any way to associate that build action by default to my custom file extension. For example, if you add a .cs file, the build action defaults to "comp...

Why is GUID attribute needed in the first place?

What is the necessity for the GUID attribute? why don't just let the compiler handle this automatically?! ...