SyntaxHighlighter Build Test Page
Thoughts from a C# Developer

Code Posts

  • Lambda Expressions

    Wednesday, August 05, 2009
    This just in: Lambda Expressions are cool. Yes, I'm a tad late, given that this language feature has been around for some time (introduced originally in .net 3.0, and packaged in .net 3.5). But to my defense, I have these reasons: (1) There wasn’t a need for it on my end, (2) I was working in a .net 2.0 shop, (3) There were so many feature enhancements that this particular one flew under the radar. Fast forward to today, I've written my first lambda expression and wish to share it. So what are lambda expressions? In my own words, they
  • Validation Application Block

    Wednesday, February 18, 2009
    How many hours during the day do you sit around and write validation code?  Way to many to count, if I'm reading your mind. Validation is pretty common it's in usage that it occurred to me that I needed some sort of compact way of encapsulating rules and business logic. So on my train ride home, I thought to myself -- "Gee, I guess I could create validation attributes, and decorate my properties!" I really thought I was brilliant, and somewhat innovative, but lo and behold, I get home and discover there's already an application block written for just that
    Filed under | 0 comments »
  • StringDictionary will lower your keys (and your expectations)

    Monday, February 02, 2009
    I needed to store a collection of key/value strings, so I turned to a familiar class I've used in the past: System.Collections.Specialized.StringDictionary. It's pretty straightforward to use, you construct it, then add your items one at a time. However, I ran into some pretty odd behavior where all the keys I injected came back out lower cased.. and subsequently, blew up into a nice error screen because some of the underlining code was dependant on specifically cased key strings. According to microsoft: The key is handled in a case-insensitive manner; it is translated to lowercase before it is used with
    Filed under | 0 comments »
  • Dynamic Typing in C# 4.0

    Monday, October 27, 2008
    I'm here at PDC 08 and attended a great session by Anders Hejlsberg for some of the things coming down the pipe for C# 4.0. One of the more exciting offerings is the idea of resolving names in your code at runtime instead of compile time via dynamic lookup. There is a new static Type called dynamic which it's usage pattern is such: dynamic calc = new Calculator (); int sum = calc.Add(10, 20); In addition, it can be used in as a argument modifier for methods: void RunCalculator(dynamic calc, int num1, int num2) { calc.Add(num1, num2); } This is
    Filed under | 0 comments »