public static HasOutput <T> FromReferenceType <T>(T result) where T : class { var hasOutput = new HasOutput <T>(result is object, result); return(hasOutput); }
/// <summary> /// Default assumes a reference type. /// </summary> public static HasOutput <T> From <T>(T result) where T : class { var hasOutput = HasOutput.FromReferenceType <T>(result); return(hasOutput); }
public static HasOutput <T> FromValueType <T>(T result, T nonExistenceValue) where T : struct { var equalityComparer = EqualityComparer <T> .Default; var hasOutput = HasOutput.FromValueType(result, nonExistenceValue, (x, y) => equalityComparer.Equals(x, y)); return(hasOutput); }
public static HasOutput <T> FromValueType <T>(T result, T nonExistenceValue, Func <T, T, bool> equality) where T : struct { var exists = !equality(result, nonExistenceValue); var hasOutput = new HasOutput <T>(exists, result); return(hasOutput); }