.net

When I iterate through a Dictionary (.NET generic data structure) will it be in the same order that I added them?

I have a dictionary that I normally access with a key, so I need fast random access reads. However for one function I need to process every item in the dictionary where the order is important. It seems to be working OK in tests. Is it OK to depend on the order of items in a dictionary? ...

Will installing the Visual Studio 2010 +Oslo CTP screw my Visual Studio 08 install?

I'm eager to give these a go, but I've only got my precious home machine to try it out. I'm in the middle of some important work that can't get inferred with, yet I can't resist the urge to give the new bits a go. Will installing VS10 on a Vista SP1 box with VS08 screw with the VS08 experience in any way? ...

System.Drawing.Image for Images in Business Objects?

Hi Folks I'd like to store an image in a business object. In MSDN I saw that the System.Drawing-namespace provides lots of GDI+-features, etc. Is it okay to store an Image in an System.Drawing.Image class in business layer (which is a class library "only"), and thus including a reference to System.Drawing too? I slightly feel just kind...

standard way to convert to short path in .net

looking for the standard bug-proofed way to convert "long names" such as "C:\Documents and settings" to their equivalent "short names" "C:\DOCUME~1" I need this to run an external process from withing my C# app. It fails if I feed it with paths in the "long name". ...

How to specify a Colour in config

How would I specify a color in app.config and then convert that into an actual System.Drawing.Color object at runtime? ...

ShellExecute equivalent in .NET

I'm looking for the .NET-preferred way of performing the same type of thing that ShellExecute does in Win32 (opening, printing, etc. for arbitrary file types). I've been programming Windows for over 20 years, but I'm a complete newbie at .NET, so maybe I'm just looking in the wrong places. I'm currently using .NET 2.0 (VS C# 2005), but ...

.Net (C#) Detect if a television is connected

Anyone know how to detect if a television is currently connected to a PC in c#? Cheers ...

Unhandled exceptions in BackgroundWorker

My WinForms app uses a number of BackgroundWorker objects to retrieve information from a database. I'm using BackgroundWorker because it allows the UI to remain unblocked during long-running database queries and it simplifies the threading model for me. I'm getting occasional DatabaseExceptions in some of these background threads, and I...

Does .NET (Mono) support cross-platform file operations and cross-platform audio metadata handling (through libraries)?

For my next project, the two leading frontrunners are .NET and Java. The project is to take a directory (something like My Music in Windows) that contains directories and music files (MP3s initially, but eventually expanded to other music formats). For each file, it would allow you to play the file and view/edit its metadata, filename, a...

Implementing GetByClassName for a .Net XmlDocument.

I am using an XmlDocument to parse and manipulate an XHTML string, converting some nodes to non-HTML nodes. What is the best way to get a list of all nodes with a given class name? Can it be done with XPath? ...

Which built-in .NET cryptography algorithm is the most secure?

Hi, Which cryptography algorithm is the most secure that ships with .net? ...

Serialize in a human readable text format

Is there a way in .NET 2.0 (C#) to serialize object like you do using XmlSerializer in a simple / customizable human readable format thats for instance looks like PXLS or JSON? Also I know that XML is human readable, I'm looking for something with less annoying redundancy, something that you can output to the console as a result for the ...

Set Identity of Thread

In C#, how do I set the Identity of a Thread? For example, if I have Thread MyThread, which is already started, can I change MyThread's IIdentity ? Or is this unpossible? ...

When an Expression<T> is compiled, is it implicitly cached?

When an Expression<T> is compiled, is the resultant code implicitly cached by the framework? I'm thinking along the lines of the static Regex methods where the framework implicitly compiles and caches the last few regexes. If compiled Expression<T> objects are not cached, can you recommend some best practices for keeping the compile-tim...

Hosting the .NET runtime in a Delphi Program

I was looking into using some .NET code from within a Delphi program, I will need to make my program extensible using .net assemblies and predefined functions (I already support regular DLLs). After a lot of searching online, I found Managed-VCL, but I'm not ready to pay $250 for what I need, I also found some newsgroups with code that...

WYSIWYG Control for Winform

I am looking for a free WYSIWYG editor control to be used in a Winform application. The applications primary language is VB but using C# is also an option. To clarify I need a rich text editor control that has a formatting bar. I have looked all over the web and the only options I can find are expensive control packages that have more th...

DebuggerDisplay on generic class

I have a problem applying the DebuggerDisplay attribute on a generic class: [DebuggerDisplay("--foo--")] class Foo { } [DebuggerDisplay("Bar: {t}")] class Bar<T> { public T t; } When inspecting an object of type Bar<Foo> I would expect it to show as Bar: --foo--, but I get Bar: {Foo} What am I doing wrong? ...

COMException: The data area passed to a system call is too small

The message defined in the title of this post, along with the HResult 0x8007007A occasionally occurs while creating an instance of a Windows Workflow Foundation Runtime. The error text is pretty self explanitory, and using Reflector over the Workflow Foundation assemblies I have narrowed down the problem to one of the following calls in...

How to serialize an object to XML without getting xmlns="..."?

Is there a way for me to serialize an object in .NET without the XML Namespaces automatically serializing also? It seems that by default .NET believes the XSI and XSD namespaces should be included, but I don't want them there. ...

How can I avoid automatically attaching to T-SQL for debugging in Visual Studio 2008?

When debugging web sites that I'm working on, I tend to use Attach to Process rather than F5 to start debugging (since the site's already on in Firefox). However, occasionally when doing so, I'll get the following error: EXECUTE permission denied on object 'sp_sdidebug', database 'master', owner 'dbo'. I know this is caused by att...