Posted By

Elph on 10/14/08


Tagged

operator null


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


?? operator


 / Published in: C#
 

  1. // Si el valor de la izquierda es nulo, devuelve el de la derecha,
  2. // sino devuelve el de la izquierda
  3.  
  4. string foo = null;
  5. return foo ?? "bar; // returns bar
  6.  
  7. string foo = "dummy";
  8. return foo ?? "bar; // returns dummy

Report this snippet  

You need to login to post a comment.