Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
空白の文字列があります(" ________ ")
string MyNote= Convert.ToString(Session["MyNote"]); if(MyNote!=null || MyNote != "") { }
MyNote != "" は、文字列にスペースがある場合は機能しないため、
C# で linq を使用して文字列が "" または null であることを確認するにはどうすればよいですか?
if(MyNote!=null || MyNote.Length > 0) //or you may want to set different value than 0 { }
これは私のために働く:
string MyNote = Session["MyNote"] == null ? String.Empty : Session["MyNote"].ToString();