Find the Root of a C# Hierarchy

2 Comments »

Many objects in .NET are stored in a hierarchy.  For example: controls, files and folders, and anything you would normally display in a tree view.  There are many different algorithms for finding the root of a hierarchy.  Here is one of them:

Read the rest of this entry »

Mono v2.0 .NET for Linux Released

No Comments »

Mono is an open source implementation of the .NET framework for Linux, Windows, MacOS and other operating systems.  Mono v2.0 was just released and represents a major milestone in the Mono project.

Read more >>

Microsoft Unveils Visual Studio 2010 and .NET 4.0

No Comments »

Microsoft announced the next version of its developer platform, which will be named Visual Studio 2010 and .NET Framework 4.0.  Microsoft said VS10 will focus on five key areas (in marketing-speak): riding the next-generation platform wave, inspiring developer delight, powering breakthrough departmental applications, enabling emerging trends such as cloud computing, and democratizing application life-cycle management (ALM).

Read More >>

Interview with C# Leader Anders Hejlsberg

1 Comment »

Computerworld has published an in-depth interview with Microsoft’s leader of C# development, Anders Hejlsberg.  A prominent Danish software engineer, Hejlsberg also wrote Turbo Pascal and was lead architect of the team that developed Delphi.  Hejlsberg shared with Computerworld his thoughts on the development of C#, future programming trends, and his experiences putting out fires.  Here is a brief excerpt:

Read the rest of this entry »

Determine if Your C# Application is 64-bit

10 Comments »

It’s easy to determine if your C# application is 64-bit.  Just check the Size property of IntPtr.  If it’s 8, then your application is 64-bit.  If it’s 4, then your application is 32-bit.

Here is a simple C# console program to demonstrate this:

Read the rest of this entry »

DataGridView HideSelection to Hide Selection when Grid Loses Focus

3 Comments »

The DataGridView is a powerful grid control included in the .NET Framework.  One function missing, however, is the ability to hide the current selection when the DataGridView control is not focused.  What the DataGridView class needs is a HideSelection property, similar to the ListView and TextBox.  But the .NET designers have not included this capability in the DataGridView class.

Read the rest of this entry »

C# Switch Case Order Doesn’t Matter

3 Comments »

The order of C# switch case statements in your code has no effect on performance.

Read the rest of this entry »

Visual Studio 2008 and .NET 3.5 Service Pack 1 Released

1 Comment »

Microsoft has released Service Pack 1 for Visual Studio 2008 and .NET 3.5.  This update patches numerous bugs, improves performance, and even adds a few new features. 

As a .NET commercial software developer, I am most excited that SP1 provides a .NET Framework installation optimized for client applications.  The optimized download is less than 28 MB, compared to the original 200 MB download that all but ensured consumers would not download .NET 3.5 and hence forced us to remain on .NET 2.0 (see FAT .NET).

Read more…

Sort C# Array in Descending/Reverse Order

14 Comments »

How do you sort a C# array in descending or reverse order?  A simple way is to sort the array in ascending order, then reverse it:

Read the rest of this entry »

Check Valid File Path in C#

8 Comments »

It’s not a trivial exercise to validate a file path on a Windows PC.  There are a few special cases depending on the file system and operating subsystem:

Read the rest of this entry »

« go backkeep looking »