Saturday, April 7, 2012

Did you know that you may create an array of a value type in C# wherein the elements have default values?

I didn't, but C# 4.0 in a Nutshell illuminated that I could. This works:

[TestMethod]
public void TestMethod()
{
   int[] foo = new int[5];
   Assert.AreEqual(0, foo[4]);
   Assert.AreNotEqual(null, foo[4]);
}

I played Rummy with my Mom (Susan Jaeschke at above right) and also my Sister (Janice Jaeschke at above left) for an Easter celebration (a day early) at a coffee shop called Epoch (in Austin, Texas) today. Mom took a picture of me (Tom Jaeschke) with her 3GS. I pose with the book here:

No comments:

Post a Comment