DEV Community

Discussion on: 5 easy tips for writing C# better

Collapse
 
mteheran profile image
Miguel Teheran

Regarding number 1. I prefer the first option instend of evaluate a property

if (!string.IsNullOrEmpty(yourVar))

{

//your code

}

in C# 8, we can use the operator (?) to evaluete if the string is null or not