.net

What is the difference between ManualResetEvent and AutoResetEvent in .net?

I have read the docs on this and I think I understand. Auto resets when the code passes through event.WaitOne() but manual does not. Is this correct? ...

Open source .net windows form based controls like: gantt chart, calendar and scheduler

Is there any open source or free .net ui toolkit containing at least one of the following controls: gantt chart (ms project like) calendar (google calendar like or ms outlook 2003, 2007 like) scheduler (outlook 2007 like) Thanks ...

.NET equivalent to Java thread groups?

I'm trying to monitor the states of a group of threads in a Microsoft.NET application written in C#. I'd like to be able to also monitor any child threads spawned by the original threads. In Java, you can assign threads to a thread group, and their children will also belong to the group. Is there an equivalent in .NET? I briefly looked...

Sharing application preferences across multiple projects

We have a fairly large .NET solution with multiple executable projects (winforms and command line programs). Currently each of these projects has its own app.config that contains connection strings, mail server settings and the like. As you can imagine it's not that convenient to make a change in every app.config file whenever a particul...

Custom Compiler Warnings

When using the ObsoleteAtribute in .Net it gives you compiler warnings telling you that the object/method/property is obsolete and somthing else should be used. I'm currently working on a project that requires a lot of refactoring an ex-employees code. I want to write a custom attribute that I can use to mark methods or properties that w...

C# Potential Interview Question…Too hard?

Without running this code, identify which Foo method will be called: class A { public void Foo( int n ) { Console.WriteLine( "A::Foo" ); } } class B : A { /* note that A::Foo and B::Foo are not related at all */ public void Foo( double n ) { Console.WriteLine( "B::Foo" ); } } static void Main( string[]...

Got .PNG file. Want embeddded icon resource displayed as icon on form title bar.

This was an interview question. Given Visual Studio 2008 and an icon saved as a .PNG file, they required the image as an embedded resource and to be used as the icon within the title bar of a form. I'm looking for what would have been the model answer to this question, Both (working!) code and any Visual Studio tricks. (Model answer is ...

Developer Machine Justification

Looking for good techniques to justify "great than normal" machine for developers. The company I work for buys the same underpowered $500 dollar systems for everyone, and looking for ways to prove ROI or arguments to use. Sorry, I didn't say this in the initial question, the stack is VS 2008, SQL 2005/2008. As duties dictate we are SQ...

Modifying default tab size in RichTextBox

Is there any way to change the default tab size in a .NET RichTextBox? It currently seems to be set to the equivalent of 8 spaces which is kinda large for my taste. Edit: To clarify, I want to set the global default of "\t" displays as 4 spaces for the control. From what I can understand, the SelectionTabs property requires you to sel...

Evaluating OPF3 (ORM framework for .NET)

Is anyone using or has anyone evaluated OPF3 as an ORM (.NET)? How does it stack up against EntitySpaces or Subsonic? One thing about OPF3 I like in my evaluation so far is that it is very easy to customize. Since it binds database fields to object members using attributes, you do not need to use any code generation tool. This also mea...

Managing third party libraries and their dependencies

Specifically, how do you handle 2 different libraries sharing a common dependency? For example, I've structured a project with a Lib\ directory with each 3rd party library (and its dependencies) contained in separate sub-directories: Lib\ IBatis\ Log4Net\ etc. This is fine if there's no overlap. Required libraries are added ...

Example code required for how to access embedded .Net image resources in C#.

It's very easy to mark an image file to become an embedded resource however how does one access the image thereafter. Please can I have some example code? ...

Why are entries in addition order in a .Net Dictionary?

I just saw this behaviour and I'm a bit surprised by it... If I add 3 or 4 elements to a Dictionary, and then do a "For Each" to get all the keys, they appear in the same order I added them. The reason this surprises me is that a Dictionary is supposed to be a HashTable internally, so I expected things to come out in ANY order (ordered...

.NET Framework platform support tradition

From the first days the .NET framework came out there was a minimum OS support: .NET 1.0 - Windows NT or higher (Windows 98/ME are also supported) .NET 2.0 - Windows 2000 or higher (Windows 98/ME are also supported) .NET 3.0 - Windows XP or higher .NET 3.5 - Windows XP or higher This minimum OS support made possible to ignore platfor...

SharpZipLib - ZipException "End of extra data" - Why am I getting this exception?

I'm using SharpZipLib version 0.85.5 to unzip files. My code has been working nicely for a couple of months until I found a ZIP file that it doesn't like. ICSharpCode.SharpZipLib.Zip.ZipException: End of extra data at ICSharpCode.SharpZipLib.Zip.ZipExtraData.ReadCheck(Int32 length) in C:\C#\SharpZLib\Zip\ZipExtraData.cs:line 933 ...

How to Conditionally Format a String in .Net?

I would like to do some condition formatting of strings. I know that you can do some conditional formatting of integers and floats as follows: Int32 i = 0; i.ToString("$#,##0.00;($#,##0.00);Zero"); The above code would result in one of three formats if the variable is positive, negative, or zero. I would like to know if there is any...

How to test SqlServer connection without opening a database

The title pretty much says it all. I want to create a SqlConnection and then check that connection without opening a database, cause at that point I don't know yet where will I connect to. Is it possible to do that? The SqlConnection class has a 'Open' member which tries to open the database you'd set in the Database property, and if yo...

Are static indexers not supported in C#?

I've been trying this a few different ways, but I'm reaching the conclusion that it can't be done. It's a language feature I've enjoyed from other languages in the past. Is it just something I should just write off? ...

Best way to bind WPF properties to ApplicationSettings in C#?

What is the best way to bind WPF properties to ApplicationSettings in C#? Is there an automatic way like in a Windows Forms Applicatoin? Similar to this question, how (and is it possible to) do you do the same thing in WPF? ...

Panel.Dock Fill ignoring other Panel.Dock setting

If you create a panel on a form and set it to Dock=Top and drop another panel and set its Dock=Fill, it may fill the entire form, ignoring the first panel. Changing the tab order does nothing. ...