29
08
2005
I didn’t think the new iterator pattern in c# 2.0 would be as useful as the other new features. I though, how many problems are solved with enumerators? Well, here is a great example where creating an enumerator isn’t the problem being solved, it’s an elegant HTTP application pipeline that uses the state machine automatically created by the c# compiler for handling asynchronous work. The new yield return statement simplifies the code significantly.
Iterators and Efficient Use of the Thread Pool
Comments : No Comments »
Categories : .NET, c#
27
08
2005
If you’ve used SQL Server, you’ve probably used the ISNULL function. It replaces NULL with the specified replacement value. In .NET 2.0, c# gets this capability with a new ?? operator – the null coalescing operator. So when you define nullable types, you can check for null, and replace it with another value with this simple syntax:
int? x = 5;
int? y = null;
// since x is not null, (x ?? 0) returns 5.
Assert.AreEqual(5, (x ?? 0));
// since y is null, (y ?? 0) returns 0.
Assert.AreEqual(0, (y ?? 0));
The operator also works with reference types:
// table can be null
public static int Fill(DataTable table)
{
// if table is null, _defaultDataTable is used instead
foreach(DataRow dataRow in table.Rows ?? _defaultDataTable.Rows)
{
// do work
}
return 0;
}
Video presentation from Tech·Ed 2005: An In-Depth Look at C# 2.0
Comments : No Comments »
Categories : .NET, c#
15
08
2005
I’ve always wanted to go to the PDC, i’ve just never been in the position to go. For example, for the 2000 Professional Developer’s Conference (PDC), I was an undergraduate student at the University of Central Florida working as a professor’s assistant, making just enough money to pay the bills. I visited the Orlando Convention Center on the last day of the PDC and picked up the first public release of .NET and Visual Studio .NET on four CDs. It was great! I was able to teach myself .NET and c# from the Tech Preview CDs and MSDN online. It was then that I realized how important the PDC was to software developers.
I had a scheduling problem with the 2003 PDC – you could imagine my surprise when I found out it conflicted with my honeymoon. I realized that I had to push my employer (for two years) to budget for training for the next PDC. My work paid off – In January of 2005, my supervisor informed me that I was going to the PDC. Unfortunately, in May, I accepted a position with another company.
Comments : 1 Comment »
Categories : .NET, Events