Sunday, January 15, 2012

of both null checks in both C# and JavaScript and the null coalescing operator of C#

Doing null checks in C# is tacky. In JavaScript it is impossible. You instead have to see if a thing has a length of 0.

if (sortOrderInput.length == 0) {

 
 

As an aside: The better thing to do in C# is a preventative step like this:

foo = foo ?? new List<Bar>();

 
 

The null coalescing operator is used in the line above. It is the ??

No comments:

Post a Comment