Monday, July 3, 2017

JavaScript-side sanity check for viability of what would be nullable Guids in C# cannot (should not) just be a falsey check.

I recommend instead:

if (foo.barId && foo.barId != '00000000-0000-0000-0000-000000000000'){

 
 

This may be overkill if you are really confident you are not assigning = new Guid(); anywhere, but I would not be too sure of your ruleset (your developers' discipline). You ever tell everyone to use the external dependency for timekeeping instead of sprinkling DateTime.Now everywhere and no one seems to get it?

No comments:

Post a Comment