.net

Odd exception thrown in .NET

Exception Thrown: "System.ComponentModel.ReflectPropertyDescriptor is not marked as Serializable" Does this mean I missed marking something as serializable myself, or is this something beyond my control? ...

.NET IExtenderProvider (C#)

I'm trying to extend the controls TextBox, ComboBox and Panel with an IExtenderProvider but I can not get it to work properly. I start to believe that I haven't understand the concept fully. Does anybody know any good resources on the web (with examples) for the IExtenderProvider? ...

Serializable Inheritance

If something inherits from a Serializable class, is the child class still Serializable? ...

Render App.config/Web.config files via XSLT

Does anyone have an XSLT that will take the app.config and render it into a non-techie palatable format? The purpose being mainly informational, but with the nice side-effect of validating the XML (if it's been made invalid, it won't render) ...

Determine highest .NET Framework version

I need to determine the highest .NET framework version installed on a desktop machine from C\C++ code. Looks like I can iterate the folders under %systemroot%\Microsoft.NET\Framework, but that seems kind of error prone. Is there a better way? Perhaps a registry key I can inspect? Thanks. ...

What is more efficient for parsing Xml, XPath with XmlDocuments, XSLT or Linq?

I have parsed Xml using both of the following two methods... Parsing the XmlDocument using the object model and XPath queries. XSL/T But I have never used... The Linq Xml object model that was new to .Net 3.5 Can anyone tell me the comparative effeciantly between the three alternatives? I realise that the particular usage would ...

What are the BEST resources for learning WPF & .NET?

I'm a longtime C/C++ Unix guy. I recently started work in a new position that's gonna eventually require C# and WPF (and probably some LINQ). What are the best resources to quickly come up to speed on all these Microsoft technologies? Years ago I read Petzold's book and loved it because it was so complete and by the end I really felt lik...

Does Mono .NET support and compile C++ / CLI?

Does Mono .NET support and compile C++ / CLI? If not, do you know if they have any plans of supporting it? ...

Is there any kind of file dependency tracer for Asp.Net apps?

I have an Asp.Net 2.0 (VB.Net) app and I'm trying to export a Control (ASCX) to another project. I need to know what other files that the Control needs in order to work. Is there any way - using VS.Net 2005 or an external app - to recursively trace the dependencies of a page or control in a solution? For example, for this file: ~/Cont...

Do I need to dispose transient disposable objects?

I have a class that creates several IDisposable objects, all of these objects are then passed to another 'manager' class in a 3rd party library. As I need some of the objects in later calls I kept a local field reference to the created objects so that I could access them at a later time. When I ran FxCop on the class it said that I shoul...

Efficiently shrinking a two dimensional array in C#

What is an efficient way to shrink a two dimensional array to a smaller size in C#? For example: var bigArray = new object[100, 100]; var smallArray = new object[10, 10]; bigArray[0, 0] = 1; bigArray[0, 1] = 2; ... bigArray[99, 99] = 100000; startRowIndex = 0; startColumnIndex = 0; endRowIndex = 9; endColumnIndex = 9; smallArray = ...

Domain Driven Design - Logical Deletes

So, I have a nice domain model built. Repositories handle the data access and what not. A new requirements has popped up that indicates that reasons need to be logged with deletes. Up until now, deletes have been fairly simple => Entity.Children.Remove(child). No internal change tracking was happening as my ORM tool was handling stat...

C# Set collection?

Does anyone know if there is a good equivelent to Java's Set collection in C#. It's one of the few things I miss from having moved to C#. I am aware that you can have a "pretend" set using a Dictionary or Hashtable and only bothering to populate the keys. But it's not very elegant. It's wierd every other way I turn in C# somone seems...

What are the differences between the Builder, Factory Method, and Abstract Factory patterns?

A program receives a list of Messages (base type). Each message in the list has to be processed according to it's type (descendant type). However, different messages need different inputs in order to be processed correctly. What is the following technique called? (I haven't checked this code in a compiler) abstract class MessageProc...

.NET Regex balancing groups expression - matching when not balanced

.NET balanced group regexes make my head explode. I've got this string i'm trying to match: other stuff blah blah.... { stuff stuff {key: stuff stuff } } more stuff........

How do I LINQify this?

Is there any way to clean up this type of loop using LINQ? List<Car> result; List<string> makes; List<string> models; for (int i = 0; i < makes.Count() && i < models.Count(); i++) { result.Add(new Car() { Make = makes[i], Model = models[i] }); } Basically I'm looking for some way to collate multiple arrays of individu...

How do convert unicode escape sequences to unicode characters in a .NET string

Say you've loaded a text file into a string and you'd like to convert all unicode escapes into actual unicode characters inside of the string. Example: "The following is the top half of an integral character in unicode '\u2320', and this is the lower half '\U2321'." I found an answer that works for me and if follows. ...

Best practice to pass information between windows.forms

What do you do to pass information between forms? Forward is straight forward (sorry) using Properties or maybe parameters in a New() or DoStuff() method, but what about sending something back when the user is done with the second form? (IE. ID of the item selected) We have used all these: Passed the calling form into the called form...

How to force C# .net app to run only one instance in Windows?

How to force C# .net app to run only one instance in Windows? ...

How to use System.IO.Compression to read/write ZIP files?

I know there are libraries out there for working with ZIP files. And, you can alternatively use the functionality built into Windows for working ZIP files. But, I'm wondering if anyone has worked out how to use the tools built into the System.IO.Compression namespace within .NET for reading/writing ZIP files? Or, is it not possible usin...