private IEnumerable <IMemberAccessor> GetFields(BindingFlags bindings) { var fields = Type.GetFields(bindings); foreach (var fieldInfo in fields) { yield return(_fieldCache.Value.GetOrAdd( fieldInfo.Name, () => FieldAccessor.Create(fieldInfo))); } }
private IMemberAccessor GetField(string name, BindingFlags bindings) { name.ThrowIfNullOrEmpty(); IMemberAccessor accessor; if (_fieldCache.Value.TryGetValue(name, out accessor)) { return(accessor); } var fieldInfo = Type.GetField(name, bindings); var value = FieldAccessor.Create(fieldInfo); _fieldCache.Value.Add(name, value); return(value); }