Wednesday, September 3, 2008

Tech Ed 2008 Day Three - DEV486 C# tips and tricks

Speakers: Jeremy Boyd, John Daniel Trask
  • PPTplex
  • Enum class to replace
    T blah = (T)Enum.Parse(typeof(T), value);
    
    with
    var blah = Enum.Parse(value);
    
    See EnumHelper using generics to reduce casting
  • Codeplex
  • Umbrella
  • Utilities.NET
  • IDesign.NET - FormHost
  • Fluent Interfaces E.g. 3.March(2003)
  • Extension Methods
  • static methods in a static class
  • Link Bridge
  • IEnumerable Extensions
    Foreach(Person person in _nodes.OfType<x>(Person)) {}
    
    using(TransactionScope scope = new TransactionScope())
    {
    }
    
  • Invariance Checking
  • Object Initializer E.g. new DataTable{CaseSensitive=false};