Microsoft Community Promise for C# and CLI

No Comments »

Microsoft is applying its Community Promise to the C# programming language and Common Language Infrastructure (CLI).  This means that anyone can freely build, sell, distribute or use programs with C# and the CLI without signing a license agreement or otherwise communicating to Microsoft.  This applies to all distribution models including open source and GPL.  Under the Community Promise, Microsoft will not assert its Necessary Claims.

In other words, build all you want with C# and .NET, Microsoft won’t sue you for copyright or patent infringement.

Specifically, this announcement applies to the ECMA 334 (C#) and ECMA 335 (CLI) specifications.

“The Community Promise is an excellent vehicle and, in this situation, ensures the best balance of interoperability and flexibility for developers,” said Scott Guthrie, Corporate Vice President for the .NET Developer Platform.

Popularity: 9% [?]

C# Decimal: Literals, Conversions and Formatting

2 Comments »

The C# decimal keyword denotes a 128-bit data type.  Compared to floating-point types, the decimal type has a greater precision and a smaller range, which makes it suitable for financial and monetary calculations.

Approximate Range: ±1.0 × 10−28 to ±7.9 × 1028

Precision:  28-29 significant digits

.NET Type:  System.Decimal

Read the rest of this entry »

Popularity: 19% [?]

The Proper Way to Show the Wait Cursor

9 Comments »

It’s common UI courtesy to show the Wait cursor when performing a long operation that requires the user to wait.  Here is how the Wait cursor appears in Windows Vista:

Wait cursor

But developers often go about this the wrong way by setting the Cursor.Current property as follows:

Cursor.Current = Cursors.WaitCursor;

Read the rest of this entry »

Popularity: 25% [?]

Clean/Strip/Remove Binary Characters from C# String

4 Comments »

Sometimes you may need to display or print an input string that contains binary characters.  The following function replaces all binary characters in a string with a blank.  You can easily modify this method to remove other undesirable characters (such as high-ASCII) if needed.

Read the rest of this entry »

Popularity: 21% [?]

Blogs from Microsoft C# Development Team

No Comments »

Want insight into the design and development of C#?  Then check out these blogs by key members of the Microsoft C# development team:

Read the rest of this entry »

Popularity: 15% [?]

Close All Forms in an Application in a Thread-Safe Manner

8 Comments »

Closing all forms in an application seems like it would be a simple task of using a foreach loop in the Application.OpenForms collection, such as:

foreach (Form form in Application.OpenForms)
{
    form.Close();
}

But there are two problems.

Read the rest of this entry »

Popularity: 32% [?]

C# Read String Line by Line

No Comments »

It’s easy to read a string one line at a time.  Here is a console program that demonstrates how:

Read the rest of this entry »

Popularity: 27% [?]

C# Convert String to Stream, and Stream to String

7 Comments »

It’s fairly easy to convert a C# String to a Stream and vice-versa.

Read the rest of this entry »

Popularity: 77% [?]

Clear C# StringBuilder

4 Comments »

Many .NET developers are baffled by the lack of a “Clear” method in the StringBuilder class.  For example, if you are using a StringBuilder in a loop, you may want to clear its contents at the beginning of each loop.

Read the rest of this entry »

Popularity: 23% [?]

Determine Windows Version and Edition with C#

5 Comments »

This article explains how to use C# to determine the name, edition, service pack, version and bits of the host operating system.

For example, the results on my PC would be:

Operation System Information
—————————-
Name = Windows Vista
Edition = Home Premium
Service Pack = Service Pack 1
Version = 6.0.6001.65536
Bits = 64

Read the rest of this entry »

Popularity: 20% [?]

keep looking »