I have been looking through code for the last 3 days, and the original developer is defining Strings using the String class rather than the string class. So, when they’ve used the IsNullOrEmpty method, it’s defined String.IsNullOrEmpty.
What I’d like to know is how is the compiler dealing with String.IsNullOrEmpty compared to string.IsNullOrEmpty?
Is there any advantages using String.IsNullOrEmpty over string.IsNullOrEmpty?
They are both the same.
string is a keyword alias in c# for System.String.
Only difference is that when using String, you need to use either
System.String.IsNullOrEmptyorusing System;at the begining of your code file.