C# Code Converter

No Comments »

DeveloperFusion offers a free .NET code converter.  Simply paste your C# or VB.NET code into this web-based tool, then select your target language: C#, VB.NET, Python or Ruby.  Supports syntax up to .NET 3.5.

Code Converter

Popularity: 1% [?]

Follow C# 411 on Twitter

No Comments »

Tired of RSS feeds?  Now you can follow C# 411 on Twitter!

C# 411 on Twitter

Cool Twitter logo from here

Popularity: 1% [?]

Type Name “UITypeEditor” Not Found

1 Comment »

This is one of those “D’oh!” moments.  You’re creating your own UITypeEditor.  You know the UITypeEditor class is located in the System.Drawing.Design namespace.  So naturally you want to add to your Visual Studio project a reference to the System.Drawing.Design.dll, right?  Wrong!  When you compile your project, the following error may appear:

The type or namespace name 'UITypeEditor' could not be found (are you missing a using directive or an assembly reference?)

It turns out that UITypeEditor is actually defined in System.Drawing.dll, even though it’s located in the System.Drawing.Design namespace.  See the disconnect?  But you can easily solve this problem by adding to your Visual Studio project a reference to System.Drawing.dll

Popularity: 1% [?]

Add Drop Shadow to Borderless Form

2 Comments »

When you create a Form with a border, Windows automatically draws a drop shadow around the form, as shown here:

Border form with shadow

However, if you set the form’s FormBorderStyle property to None, Windows draws neither the form border nor the drop shadow, as shown here:

Borderless form with no shadow

Read the rest of this entry »

Popularity: 2% [?]

.NET Framework 4 and Extensions Poster

1 Comment »

.NET Framework 4 and Extensions Poster (PDF)

Click the image above to download a .NET Framework 4 and Extensions poster from Microsoft.

Want more .NET posters?  Devcurry has published a collection of .NET Framework and Visual Studio posters including keyboard shortcut, namespace and type posters.

.NET and Visual Studio Poster Collection

Popularity: 1% [?]

Get Temporary Directory

No Comments »

To get the path of the current user's temporary folder, call the GetTempPath method in the System.IO namespace:

string tempPath = System.IO.Path.GetTempPath();

On Windows Vista and 7, this method will return the following path:

C:\Users\UserName\AppData\Local\Temp\

Popularity: 2% [?]

How  and 65279 and Other Byte Order Marks (BOM) Can Mess Up Your XML

2 Comments »

When you download XML text from the Web, you may find “garbage characters” in the start of your XML string.  For example, I encountered this result when I downloaded an XML string using WebClient.DownloadString method:

<Root><Item>Hello, World</Item></Root>

What you are likely seeing is a Byte Order Mark (BOM), which is a Unicode character that indicates the endian-ness (byte order) of a text file or stream.  The BOM is optional and will appear at the start of the text stream, if at all.  The BOM may also indicate in which of the several Unicode representations the text is encoded.

Read the rest of this entry »

Popularity: 2% [?]

C# Convert Byte Array to String

1 Comment »

It’s easy to convert a byte array to a string.  For an ASCII string, use the Encoding.ASCII.GetString static method:

byte[] buffer = new byte[10];
// todo: populate the buffer with string data
string s = Encoding.ASCII.GetString( buffer );

Popularity: 3% [?]

Convert String to Byte Array

No Comments »

It’s easy to convert a string to a byte array.  For an ASCII string, use the Encoding.ASCII.GetBytes static method:

string s = "Test String";
byte[] byteArray = Encoding.ASCII.GetBytes( s );

Popularity: 3% [?]

Read File into Byte Array

1 Comment »

It’s easy to read a file into a byte array.  Just use the File.ReadAllBytes static method.  This opens a binary file in read-only mode, reads the contents of the file into a byte array, and then closes the file.

string filePath = @"C:\test.doc";
byte[] byteArray = File.ReadAllBytes( filePath );

Popularity: 3% [?]

keep looking »