public static void NoneNull <T>(IEnumerable <T> coll, string message) { if (coll.Any(x => x is null)) { ValueException.Throw(message); } }
public static void NotEmpty <T>(IEnumerable <T> coll, string message) { if (coll.None()) { ValueException.Throw(message); } }
public static void Ensure(bool expression) { if (!expression) { ValueException.Throw("Expression does not equal true."); } }
public static void Ensure(bool expression, [NotNull] string message) { if (!expression) { ValueException.Throw(message); } }
public static void ValidSnowflake([CanBeNull] string snowflake, [NotNull] string message) { Require(snowflake, message); var nw = snowflake.Replace(" ", ""); if (nw.Length > 20 || !nw.All(char.IsNumber)) { ValueException.Throw($"{message} is not a valid snowflake string! Provided: \"{snowflake}\""); } }