C# Sample Code
-
Parse a UK Date String
by James Crowley
Ever wondered why DateTime.Parse doesn't recognise non-US date format? Here's how to get it to!
-
Easy Asynchronous Programming
by Simon Soanes
A simple demonstration of how to use multithreading and delegates in .NET to execute a method that will take a long time, without locking up our main thread.
-
Read MP3 Tag Information (ID3v1 and ID3v2)
by Erin Jones
This sample source code demonstrates how to read IP3v1 and IP3v2 tag information from MP3's, along with MPEG headers too.
-
Inserting images into Word documents using XML
by Jonathan Greensted
I've seen many, many requests on the Microsoft newsgroups asking how you can insert a picture into a Word document without saving it to the file system first. This example application described in this blog illustrates both methods for inserting a picture firstly using the Word object model (InlineShapes.AddPicture) and secondly using Word's XML support (InsertXML).
-
Windows Forms and the Idle Loop
by Mike Taulty
When you're writing Windows Forms applications it's always nice to be able to keep the UI responsive in order to avoid frustrating the user. Here's a method of completing your asynchronous work on the Application Idle loop rather than allowing another thread to wander into your Windows Forms code and then trying to deal with it by Control.Invoke.
-
Calculate Age
by James Crowley
How to calculate someone's age from their birth date.
-
Save a Stream to a File
by James Crowley
Demonstrates how to write a stream to a file.
-
Double buffering in .NET
by Simon Soanes
Ever wondered how to double buffer with a Graphics object so your GDI+ based game/control doesn't flicker annoyingly? Here's how!
-
Simple Object Relation Mapping with Reflection
by Simon Soanes
This is some code I wrote a little while back as an example O/R mapper.
-
Modify a Window's System Menu
by Steven Cohn
How to add an additional menu item to a windows system menu.
-
Asynchronous HttpWebRequest
by Steven Cohn
Demonstrates how to build a much more responsive and user-friendly application by using asynchronous HttpWebRequests.
-
Validating an Integer
by Simon Soanes
How to validate an Integer the fast/efficient way in C# using Double.TryParse()
-
Custom Word Wrapper
by David Cumps
A nice little class that takes some text, and will automatically wrap it according to a specified width.
-
IE Browser Helper Objects
by Steven Cohn
A demonstration of how to implement an IE Browser Helper Object in C#
-
Capture a Screen Shot
by James Crowley
Demonstrates how to capture a screen shot of the entire desktop, or a particular window in C# or VB.NET.
-
A PagingRepeater control
by Dan Glass
A PagingRepeater control extending Repeater with page navigation
-
Create Hashes - MD5, SHA1, SHA256, SHA384, SHA512
by David Cumps
In PHP its a simple task to generate hashes, but in C# it takes a little more work. We'll create a Hash class to simplify the process.
-
RSS Feed Helper Class
by James Crowley
A simple helper class to make generating an RSS feed a piece of cake - its the one we use on Developer Fusion too!
-
How to access a MySQL database with .NET
by Edward Tanguay
Demonstrates how to connect to a MySQL database with C#.
-
UI Threading Helper Classes
by Roy Osherove
One of the most cumbersome things you will ever have to do with Winforms is updating your User interface while receiving events from another thread. These helper classes make it a breeze.