SQLintersection session – A Tour through C# and Visual Basic Language Changes

I attended the SQL intersection conference in November 2014 in Las Vegas, Nevada.  I am including my notes from the sessions in this blog, primarily for my own reference later.  For anyone that comes across these notes, please take them with a grain of salt – I may very easily have misheard something or have written it down incorrectly.

This is one of two development session I attended.

Session Title:  A Tour through C# and Visual Basic Language Changes
Instructor: Kathleen Dollard

Visual Studio v14 is coded in native language (C#, VB)

    • Open source, transparent, etc.
    • Language extensibilities through analyzers
    • Language features have cleaner semantics
      • Some of these are in flux and may not happen
      • public int Id {get;} [=1;]
        • Can only init during construction; or, have initializer in code
      • Remove class name from static method calls
      • Initializers for dictionaries
        • new Dictionary<string, Customer> = { [“A”] = new Cust(…), [“B”] = new Cust(…) }
      • await in catch/finally blocks
      • Conditional catch (exception filters)
        • catch (Exception ex) if (ex.Code == 4) { … }
      • Expression body members
        • public string FullName => FirstName + “ “ + LastName;
      • Null propagation (aka null conditionals; sometimes call Elvis operator!)
        • x ?. x.Y
        • Evaluates to null if x is null, else evaluates to x.Y
        • Example
          • If (Event != null) { Event.Invoke (…); }
          • Now becomes: Event?.Event.Invoke (…)
        • array ?[index]
          • Checks if index has value (?)
        • String interpolation
          • Format(“{0} {1} {2}”, x, y, z)
          • Can now be written as $”\{x} \{y} \{z}”  (maybe will require \ prefix instead of $; still in limbo)
        • nameof
          • void method(int abc) { if (abc < 0} throw new ArgumentOutOfRangeException(nameof(abc)); }
        • Visual Studio features
          • Breakpoint peek
            • Debug breakpoints (conditions, actions)
            • Tip: set hit count = 999999, will show actual hit count on exception
            • Tip: if breakpoints don’t hit, close VS, delete sou files and restart VS
          • Performance tips
            • Stepping through code will show elapsed time for running
          • Name refactoring
            • Ctrl RR while on an identifier will change all references
          • Other refactoring
            • Select code block, extract block
          • Touch to zoom or scroll
          • Improved coloration (i.e., hover tips on identifier)
          • Word part intelligence (ArgExp will find ArgumentException)
          • Proper case menus

Peek in XAML

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.