I have a little confusion with the following things:
When I use Conditional Statements OR while assigning values, I am a little bit confused with these things. Sometimes it throws error and some times it works. I want to know when I want to use the above things. Are they specific with datatypes? I need your valuable suggestions please.
null is one of two things:
0 as a reference)Nullable<T> struct, which does not currently have a value (the HasValue property will also return false)DBNull is specific to some parts of ADO.NET to represent null in the database. I have yet to think of a good reason why they didn't just use regular null here.
"" is a string literal with length zero - a perfectly valid, but empty, string. The significance of this is that between null string and a "" string, instance methods like value.Trim() will behave differently; null.Trim() will throw an exception; "".Trim() is just "". In general, using string.IsNullOrEmpty(value) as a test makes this distinction go away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With