Useful C# CodeSnippets for VS2005

For any reason VS 2005, doesn't ship with code snippets for C#, although it does for Visual Basic. There is a huge package of useful snippets ready for download on MS's Visual Studio page: Visual Studio 2005: Visual Studio 2005 Code Snippet


E.g. inserting the code snippet "Search a Directory for a file recursively" inserts this code to your class file:

System.Collections.ArrayList files = new System.Collections.ArrayList();
 DirSearch(@"C:",ref files);
//Method to Search Directory for specified file Type.Paste it outside the function
public void DirSearch(string sDir,ref System.Collections.ArrayList files)
	   foreach (string d in System.IO.Directory.GetDirectories(sDir))
		foreach (string f in System.IO.Directory.GetFiles(d, "*.txt"))
		DirSearch(d,ref files);
	catch (System.Exception excpt)
Published in: on May 21, 2006 at 9:41 am  Leave a Comment  

The URI to TrackBack this entry is:

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: