Yes, there’s the String.IsNullOrEmpty
helper method for exactly this already:
if (String.IsNullOrEmpty(myString)) {
...
}
More Related Contents:
- How to do ToString for a possibly null object?
- string.Empty vs null.Which one do you use?
- What is a NullReferenceException, and how do I fix it?
- Parse string to DateTime in C#
- Most efficient way to concatenate strings?
- How to convert UTF-8 byte[] to string
- Replace Line Breaks in a String C#
- How can I String.Format a TimeSpan object with a custom format in .NET?
- Convert String to Type in C# [duplicate]
- Setting Objects to Null/Nothing after use in .NET
- How do I split a string by a multi-character delimiter in C#?
- When is it better to use String.Format vs string concatenation?
- Way to have String.Replace only hit “whole words”
- Best way to resolve file path too long exception
- String Concatenation using ‘+’ operator
- What is the difference between “x is null” and “x == null”?
- Escape curly brace ‘{‘ in String.Format [duplicate]
- How to parse a string into a nullable int
- Why is there no Char.Empty like String.Empty?
- How do I split a string by strings and include the delimiters using .NET?
- How do I truncate a .NET string?
- String interning in .Net Framework – What are the benefits and when to use interning
- Need to perform Wildcard (*,?, etc) search on a string using Regex
- If strings are immutable in .NET, then why does Substring take O(n) time?
- string.ToLower() and string.ToLowerInvariant()
- C# Version Of SQL LIKE
- What is the correct way to compare char ignoring case?
- Compare string similarity
- How to convert string to integer in C#
- Regex nested parentheses