public static void IfNull <T>( [CanBeNull][AssertionCondition(AssertionConditionType.IS_NOT_NULL)] T value, [NotNull][System.Diagnostics.CodeAnalysis.NotNull] string name) { Fail.RequiresArgumentName(name); Fail.IfNull(value, Violation.WhenVariableIsNull(name)); }
public static T FailIfNull <T>( [CanBeNull][AssertionCondition(AssertionConditionType.IS_NOT_NULL)][NoEnumeration] this T value, [NotNull][System.Diagnostics.CodeAnalysis.NotNull] string name) { Fail.RequiresArgumentName(name); return(value.FailIfNull(Violation.WhenVariableIsNull(name))); }
public static T OrFail <T>(this T?value, [NotNull][System.Diagnostics.CodeAnalysis.NotNull] string name) where T : struct { Fail.RequiresArgumentName(name); if (value == null) { throw Fail.Because(Violation.WhenVariableIsNull(name)); } return(value.Value); }