public NewDynamicPropertyAccessor GetAccessor(Type type, string propertyName) { NewDynamicPropertyAccessor accessor; Dictionary <string, NewDynamicPropertyAccessor> typeCache; if (this.m_cache.TryGetValue(type, out typeCache)) { if (typeCache.TryGetValue(propertyName, out accessor)) { return(accessor); } } lock (m_mutex) { if (!this.m_cache.ContainsKey(type)) { this.m_cache[type] = new Dictionary <string, NewDynamicPropertyAccessor>(); } accessor = new NewDynamicPropertyAccessor(type, propertyName); this.m_cache[type][propertyName] = accessor; return(accessor); } }
public NewDynamicPropertyAccessor GetAccessor(Type type, string propertyName) { NewDynamicPropertyAccessor accessor; Dictionary<string, NewDynamicPropertyAccessor> typeCache; if (this.m_cache.TryGetValue(type, out typeCache)) { if (typeCache.TryGetValue(propertyName, out accessor)) { return accessor; } } lock (m_mutex) { if (!this.m_cache.ContainsKey(type)) { this.m_cache[type] = new Dictionary<string, NewDynamicPropertyAccessor>(); } accessor = new NewDynamicPropertyAccessor(type, propertyName); this.m_cache[type][propertyName] = accessor; return accessor; } }