Author Topic: null coalescing operator ??  (Read 2290 times)

0 Members and 1 Guest are viewing this topic.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8746
  • AKA Daniel
null coalescing operator ??
« 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:

Bryco

  • Water Moccasin
  • Posts: 1883
Re: null coalescing operator ??
« Reply #1 on: January 21, 2008, 10:46:35 AM »
that's going to come in handy.

sinc

  • Guest
Re: null coalescing operator ??
« Reply #2 on: January 21, 2008, 12:46:31 PM »
Looks like they borrowed an element from Perl.  That sort of structure can be convenient.