I have code similar to this:
string s = CreateString();
if (s == "") foo(s);
If s is equal to "", call foo. If the string is null, which should never happen, then the NullReferenceException is fine (since this is, after all, an exception).
CodeAnalysis tells me to test s.IsNullOrEmpty. This would change functionality in several ways.
Performance is not a problem.
Is it safe to prevent the CA1820 warning associated with it?
Edit: Updated sample code and text to better reflect my case.
Edit: This is the (slightly modified) actual code (it is in the standard IXmlSerializable implementation):
public void ReadXml (XmlReader reader)
string img = reader.ReadElementString ("Image");
if (img != "") {
Image = Image.FromFile(img);
}