Friday, March 31, 2006

Favorite features in .NET 2.0

Edgar posted today about one of the new functions in .NET 2.0 to make your life easier, like using

aString.IsNullOrEmpty()
instead of
aString != null && aString != "";

it reminded me about this video from Kit George where he shows some of the new cool little functions that will help you a lot

in .NET 2.0 you can now use:

if (aString.Contains(otherString))
instead of:
if (aString.IndexOf(otherString)<>0)

or

foreach(string line in File.ReadAllLines("c:\theFilePath"))
Console.WriteLine(line)

instead of:
string line;
using (StreamReader sr = new StreamReader("c:\TheFilePath")) {
while ((line = sr.ReadLine()) != null)
Console.WriteLine(line);
}

check out the video to learn more about these and other features

you'll also find the link on my delicious feed under videos

No comments: