
Untitled
By: a guest on
Jul 15th, 2012 | syntax:
None | size: 0.60 KB | hits: 11 | expires: Never
asp.net master property string, how to check in content page if string is empty
public String SharedInfo
{
get { return (String)Session["SharedInfo"]; }
set { Session["SharedInfo"] = value; }
}
if (String.IsNullOrEmpty(Master.SharedInfo)) {
...
}
string s = null;
int i = s.Length; // <-- Throws null reference exception
string s = "";
int i = s.Length; // OK, i => 0
string s = "";
Console.WriteLine(Object.ReferenceEquals(s, "")); // --> true
Console.WriteLine(Object.ReferenceEquals(s, String.Empty)); // --> true
if (String.IsNullOrWhitespace(Master.SharedInfo)) {
...
}