What do you think about ??= operator in C#?

Posted by TN on Stack Overflow See other posts from Stack Overflow or by TN
Published on 2010-03-30T15:18:01Z Indexed on 2010/03/30 15:33 UTC
Read the original article Hit count: 484

Do you think that C# will support something like ??= operator?

Instead of this:

if (list == null)
  list = new List<int>();

It might be possible to write:

list ??= new List<int>();

Now, I could use (but it seems to me not well readable):

list = list ?? new List<int>();

© Stack Overflow or respective owner

Related posts about c#

Related posts about operators