.net

When using click-once deployment, is there a 'Publish Date' property available.

I want to show the publish date in the About dialog. ...

Random Gaussian Variables

Hi there, does someone of you know if there is a class in the standard library of .net, that gives me the functionality to create random variables that follow a gaussian distribution? Greets Sebastian ...

How to avoid File Blocking

We are monitoring the progress of a customized app (whose source is not under our control) which writes to a XML Manifest. At times , the application is stuck due to unable to write into the Manifest file. Although we are covering our traces by explicitly closing the file handle using File.Close and also creating the file variables in Us...

ORM support for compound primary keys

I've read that compound primary keys will confuse the hell out of typical ORM code generators. Which ORMs work best with compound PKs and which to avoid? (I've a particular interest in .NET) ...

Which built-in .net exceptions can I throw from my application?

If I need to throw an exception from within my application which of the built-in .net exception classes can I use? Are they all fair-game? When should I derive my own? ...

Read MAC Address from network adapter in .NET

I'd like to be able to read the mac address from the first active network adapter using VB.net or C# (using .NET 3.5 SP1) for a winform application ...

Best way to determine if a .NET Windows service has not hung?

What is the best way to actively monitor if a .NET Windows service is still running (e.g not hung)? The service needs to periodically respond to events raised by a timer. Thanks Jon ...

Difference initializing static variable inline or in static constructor in C#

I would like to know what is the difference between initializing a static member inline as in: class Foo { private static Bar bar_ = new Bar(); } or initializing it inside the static constructor as in: class Foo { static Foo() { bar_ = new Bar(); } private static Bar bar_; } ...

How can I differentiate between single and double clicks in .Net?

I want to override OnMouseClick and OnMouseDoubleClick and perform different actions depending on which click style was used. The problem is that OnMouseClick is happening for both single and double clicks, and is getting called before OnMouseDoubleClick. I'm certain this must be a common requirement, so I guess I'm missing something p...

Opening XPS document in .Net causes a memory leak

The following code snippet illustrates a memory leak when opening XPS files. If you run it and watch the task manager, it will grow and not release memory until the app exits. '** Console application BEGINS. Module Main Const DefaultTestFilePath As String = "D:\Test.xps" Const DefaultLoopRuns As Integer = 1000 Public Sub ...

Are there any control libraries for Windows Mobile that enable iPhone-style touchscreen behavior?

The way the iPhone uses the touchscreen to enable zooming in and out and scrolling and so forth is very cool, and I was wondering if there is anything available for Windows Mobile that provides a similar user experience. ...

How do I execute code AFTER a form has loaded?

In .NET, Windows Forms have an event that fires before the Form is loaded (Form.Load), but there is no corresponding event that is fired AFTER the form has loaded. I would like to execute some logic after the form has loaded. Can anyone advise on a solution? ...

Is there a benefit to JUST a "throw" in a catch?

Been having a "heated debate" with a colleague about his practice of wrapping most of his functions in a try/catch but the catch has JUST a "throw" in it e.g. Private sub foo() try 'Do something' catch throw 'And nothing else!' End Try End Sub My thought was to not even bother (assuming you don't need to do...

dropdownextender Ajax tool kit

How to implement in dropdownextender to go to the selected item by keyboard or go to items starting with 'A' when i press 'A' on my keyboard, i need it work as a normal drop down control. good reference i got from it good ideas: http://www.dotnetcurry.com/ShowArticle.aspx?ID=167 ...

How can I check my .NET assembly for freshness?

All, I'm working on a SharePoint project, but this isn't a SharePoint-specific question per-se. I have an assembly I've deployed to a SharePoint farm, and I'd like to verify whether my "newest version" is sitting in the GAC, or if an older version from late yesterday is sitting there instead. This is a test farm, so yes, we are revving ...

C#: Force Compiler error on use of myObj.ToString()

I have a class that contains a bunch of properties. It is a mistake by a programmer if they call ToString() on an object of that type. Take this example code: using System; public class Foo { public int ID = 123; public string Name = "SomeName"; private string ToString() { return null; } } public class MyClass { publi...

C# Generics: Can I constrain to a set of classes that don't implement an interface?

I have 3 classes that are essentially the same but don't implement an interface because they all come from different web services. e.g. Service1.Object1 Service2.Object1 Service3.Object1 They all have the same properties and I am writing some code to map them to each other using an intermediary object which implements my own interf...

Best way to turn an integer into a month name in c#?

Is there a best way to turn an integer into its month name in .net? Obviously I can spin up a datetime to string it and parse the month name out of there. That just seems like a gigantic waste of time. ...

.NET 2.0 or 3.5?

Our clients use a vb6 version of our software. We are upgrading them to a .NET application written in C#... Is there less bulk using .net 2.0 than .net 3.5? My definition of less bulk would be: Smaller size, smaller installation time, etc. Most of them probably already have 2.0 anyway. I only ask because I would like to take advanta...

Can anyone suggest an abstract base class to prevent XSRF in .NET 2.0+

I'm looking for an abstract base class or master page solution that will prevent anyone from doing XSRF using both a token and ttl. Can anyone point me in the right direction? Edit: The ideal solution will leverage the cookie that the default membership provider sends down to the client. ...