Beispiel #1
0
        public static HasOutput <T> FromReferenceType <T>(T result)
            where T : class
        {
            var hasOutput = new HasOutput <T>(result is object, result);

            return(hasOutput);
        }
Beispiel #2
0
        /// <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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }