System.StringEx.IsNullOrWhiteSpace C# (CSharp) Метод

IsNullOrWhiteSpace() публичный статический метод

public static IsNullOrWhiteSpace ( string? value ) : bool
value string?
Результат bool
        public static bool IsNullOrWhiteSpace(this string? value)
        {
            // https://referencesource.microsoft.com/#mscorlib/system/string.cs,55e241b6143365ef

            if (value == null) return true;

            for (int i = 0; i < value.Length; i++)
            {
                if (!char.IsWhiteSpace(value[i])) return false;
            }

            return true;
        }
    }

Usage Example

 // ReSharper disable once BuiltInTypeReferenceStyle
 public static bool NotNullNorWhiteSpace([CanBeNull] this string str) => !StringClass.IsNullOrWhiteSpace(str);