Thomas Bandt

Über mich | Kontakt | Archiv

String.IsNullOrEmpty() suckt

   1:  private static bool IsReallyNullOrEmpty(string text)
   2:  {
   3:      return String.IsNullOrEmpty(text) || text.Trim().Length == 0;
   4:  }

 

Kommentare

  1. Jens Hofmann schrieb am Freitag, 24. April 2009 18:27:00 Uhr:

    Ich hab mir dafür ne Extensionmethod gebastelt:

    public static bool IsNullOrTrimmedEmpty(this string strText)
    {
    return (strText == null) || (strText.Trim().Length == 0);
    }
  2. Thomas schrieb am Freitag, 24. April 2009 19:22:00 Uhr:

    Japp, gute Idee. Aber dann ohne ungarische Notation ;-).
  3. Jens Hofmann schrieb am Samstag, 25. April 2009 20:03:00 Uhr:

    "strText" wird in der Firma so verlangt, ich hasse es! Privat mach ich den scheiss nicht :D


« Zurück  |  Weiter »