TheSwamp

Code Red => .NET => Topic started by: It's Alive! on January 21, 2008, 09:07:37 AM

Title: null coalescing operator ??
Post by: It's Alive! on January 21, 2008, 09:07:37 AM

This is pretty interesting http://blog.devstone.com/Aaron/archive/2006/01/02/1404.aspx

Code: [Select]
   [CommandMethod("doit")]
    public static void doit()
    {
      Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
      string userName = "Dan";
      ed.WriteMessage(userName ?? "User name not specified");
    }

I guess I need to re-read my C# book  :laugh:
Title: Re: null coalescing operator ??
Post by: Bryco on January 21, 2008, 10:46:35 AM
that's going to come in handy.
Title: Re: null coalescing operator ??
Post by: sinc on January 21, 2008, 12:46:31 PM
Looks like they borrowed an element from Perl.  That sort of structure can be convenient.