Esempio n. 1
0
 /// <summary>
 /// Gets an evaluator delegate for the specified <paramref name="member"/>.
 /// </summary>
 /// <param name="member">The member to get an evaluator delegate for.</param>
 /// <returns>An evaluator delegate for the specified <paramref name="member"/>.</returns>
 public override Delegate GetEvaluator(MemberInfo member)
 {
     if (ShouldCache(member))
     {
         return(_getEvaluator.Delegate(member));
     }
     else
     {
         return(base.GetEvaluator(member));
     }
 }
Esempio n. 2
0
            public T Intern(T value)
            {
                var weakRef = _delegate.Delegate(value);

                if (!weakRef.TryGetTarget(out T res))
                {
                    res = _clone(value);
                    weakRef.SetTarget(res);
                }

                return(res);
            }
Esempio n. 3
0
            // NB: Hashing of members is independent of any context. This assumption would change in case members
            //     could have references to generic parameters of defining types. However, we don't deal with open
            //     generic declaring types for members in the context of expression trees, so we can memoize just
            //     fine over here.

            public override int Visit(MemberInfoSlim member) => _visitCache.Delegate(member);