public Delegate GetDelegate(CallInfo_ callInfo, Func <Delegate> func) { Delegate action; bool exist; readerWriterLock.EnterReadLock(); try { exist = _Map.TryGetValue(callInfo, out action); } finally { readerWriterLock.ExitReadLock(); } if (exist) { return(action); } readerWriterLock.EnterWriteLock(); try { if (!_Map.ContainsKey(callInfo)) { action = func(); _Map.Add(callInfo, action); } } finally { readerWriterLock.ExitWriteLock(); } return(action); }
protected MemberInfo GetAttribute(CallInfo_ call) { if (call.MemberTypes == MemberTypes.Property) { PropertyInfo member = call.TargetType.GetProperty(call.Name, BindingFlags.NonPublic | BindingFlags.Public | ScopeFlag); if (member != null) { return(member); } throw new MissingMemberException((call.IsStatic ? "Static property" : "Property") + " '" + call.Name + "' does not exist"); } if (call.MemberTypes == MemberTypes.Field) { FieldInfo field = call.TargetType.GetField(call.Name, BindingFlags.NonPublic | BindingFlags.Public | ScopeFlag); if (field != null) { return(field); } throw new MissingFieldException((call.IsStatic ? "Static field" : "Field") + " '" + call.Name + "' does not exist"); } throw new ArgumentException(call.MemberTypes + " is not supported"); }
protected AttributeEmitter(CallInfo_ callInfo, DelegateCache cache) : base(callInfo, cache) { }
public CtorInvocationEmitter_(CallInfo_ callInfo, DelegateCache cache) : base(callInfo, cache) { }
protected BaseEmitter_(CallInfo_ callInfo, DelegateCache cache) { this.CallInfo = callInfo; this.Cache = cache; }
public AttributeSetEmitter(CallInfo_ callInfo, DelegateCache cache) : base(callInfo, cache) { }
protected InvocationEmitter_(CallInfo_ callInfo, DelegateCache cache) : base(callInfo, cache) { }