Checking Null is super Important


Check Null is so important in daily programming. Developers should be aware of this super important step.

For String:

  1. we can use if statement like string str =””; str!=null;

2. string.IsNullOrEmpty(str)

For object: For Example, var animal = new Animal();

if animal != null

object animal could have so many properties. The way of checking those properties is the same as object animal.

For nullable value type. we can use int i = 1;

i.HasValue

i.GetValueOrDefault

Social Media


Categories



All Posts



Contact Info