[OT] C# 6.0 ?. null propagation operator

weaselcat via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 20 01:24:07 PDT 2015


http://www.reddit.com/r/programming/comments/335b1s/the_new_operator_in_c_6/

of interesting note was the nim sample on how to implement the 
same thing in nim in 2 lines of code

template `?.`(a, b): expr =
   if a != nil: a.b else: nil

template `??`(a, b): expr =
   if a != nil: a else: b


More information about the Digitalmars-d mailing list