internal static CallSite <T> CreateCallSite <T>( Type specificBinderType, LazyBinder binder, MemberInvocationMoniker name, Type context, string[] argumentNames = null, bool staticContext = false, bool isEvent = false) where T : class { var hashCode = BinderHashGenerator <T> .Create(name, context, argumentNames, specificBinderType, staticContext, isEvent); lock (_binderCacheLock) { CallSite callSite; if (!_binderCache.TryGetValue(hashCode, out callSite)) { callSite = CallSite <T> .Create(binder()); _binderCache[hashCode] = callSite; } return((CallSite <T>)callSite); } }
public virtual bool Equals(BinderHashGenerator other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } var tArgNames = ArgumentNames; var tOtherArgNames = other.ArgumentNames; return (!(tOtherArgNames == null ^ tArgNames == null) && other.IsEvent == IsEvent && other.StaticContext == StaticContext && Equals(other.Context, Context) && Equals(other.BinderType, BinderType) && Equals(other.DelegateType, DelegateType) && Equals(other.Name, Name) && (null == tArgNames || tOtherArgNames.SequenceEqual(tArgNames))); }
internal static CallSite CreateCallSite( Type delegateType, Type specificBinderType, LazyBinder binder, MemberInvocationMoniker name, Type context, string[] argumentNames = null, bool staticContext = false, bool isEvent = false) { var hash = BinderHashGenerator.Create(delegateType, name, context, argumentNames, specificBinderType, staticContext, isEvent); lock (_binderCacheLock) { CallSite tOut; if (!_binderCache.TryGetValue(hash, out tOut)) { tOut = CallSite.Create(delegateType, binder()); _binderCache[hash] = tOut; } return(tOut); } }