Exemple #1
0
        public VariableDefinition(object instance, PropertyInfo property)
        {
            Name = property.Name;

            var getMethod = property.GetGetMethod(false);

            if (getMethod == null)
            {
                Getter = delegate { return(default(TValue)); }
            }
            ;
            else
            {
                Getter = (FunctionOut <TValue>)Delegate.CreateDelegate(typeof(FunctionOut <TValue>), instance, getMethod);
            }

            var setMethod = property.GetSetMethod(false);

            if (setMethod == null)
            {
                Setter = delegate { }
            }
            ;
            else
            {
                Setter = (FunctionIn <TValue>)Delegate.CreateDelegate(typeof(FunctionIn <TValue>), instance, setMethod);
            }
        }
 public FunctionInWrapper(FunctionIn <T, TResult> function)
 => this.function = function ?? throw new ArgumentNullException(nameof(function));
Exemple #3
0
 public SchemaVariableDefinition(string name)
 {
     Name   = name;
     Getter = () => value;
     Setter = value => this.value = value;
 }
 public static SpanSelectRefEnumerable <TSource, TResult, FunctionInWrapper <TSource, TResult> > Select <TSource, TResult>(this ReadOnlySpan <TSource> source, FunctionIn <TSource, TResult> selector)
 => source.SelectRef <TSource, TResult, FunctionInWrapper <TSource, TResult> >(new FunctionInWrapper <TSource, TResult>(selector));
 public static ReadOnlySpanWhereRefEnumerable <TSource, FunctionInWrapper <TSource, bool> > Where <TSource>(this ReadOnlySpan <TSource> source, FunctionIn <TSource, bool> predicate)
 => source.WhereRef(new FunctionInWrapper <TSource, bool>(predicate));
 internal static MemorySelectRefEnumerable <TSource, TResult, FunctionInWrapper <TSource, TResult> > Select <TSource, TResult>(this ReadOnlyMemory <TSource> source, FunctionIn <TSource, TResult> selector)
 => source.SelectRef <TSource, TResult, FunctionInWrapper <TSource, TResult> >(new FunctionInWrapper <TSource, TResult>(selector));
Exemple #7
0
 internal static MemoryWhereAtRefEnumerable <TSource, FunctionInWrapper <TSource, int, bool> > Where <TSource>(this Memory <TSource> source, FunctionIn <TSource, int, bool> predicate)
 => source.WhereAtRef(new FunctionInWrapper <TSource, int, bool>(predicate));
 public static bool Any <TSource>(this Span <TSource> source, FunctionIn <TSource, bool> predicate)
 => source.AnyRef(new FunctionInWrapper <TSource, bool>(predicate));
 public static Dictionary <TKey, TElement> ToDictionary <TSource, TKey, TElement>(this Span <TSource> source, FunctionIn <TSource, TKey> keySelector, FunctionIn <TSource, TElement> elementSelector, IEqualityComparer <TKey>?comparer = default)
     where TKey : notnull
 => ((ReadOnlySpan <TSource>)source).ToDictionary(keySelector, elementSelector, comparer);
Exemple #10
0
 public static SpanWhereAtRefEnumerable <TSource, FunctionInWrapper <TSource, int, bool> > Where <TSource>(this Span <TSource> source, FunctionIn <TSource, int, bool> predicate)
 => source.WhereAtRef(new FunctionInWrapper <TSource, int, bool>(predicate));
Exemple #11
0
 public static bool All <TSource>(this Span <TSource> source, FunctionIn <TSource, int, bool> predicate)
 => source.AllAtRef(new FunctionInWrapper <TSource, int, bool>(predicate));
 public static Dictionary <TKey, TSource> ToDictionary <TSource, TKey>(this ReadOnlySpan <TSource> source, FunctionIn <TSource, TKey> keySelector, IEqualityComparer <TKey>?comparer = null)
     where TKey : notnull
 => source.ToDictionaryRef(new FunctionInWrapper <TSource, TKey>(keySelector), comparer);
 public static bool All <TSource>(this ReadOnlySpan <TSource> source, FunctionIn <TSource, bool> predicate)
 => source.AllRef(new FunctionInWrapper <TSource, bool>(predicate));
Exemple #14
0
 public VariableDefinition(string name, FunctionOut <TValue> getter, FunctionIn <TValue> setter)
 {
     Name   = name;
     Getter = getter;
     Setter = setter;
 }