コード例 #1
0
ファイル: Field.cs プロジェクト: rogeralsing/FastAccessors
        internal static object GetFieldValue(Type type, string fieldName)
        {
            Func <object> accessor;
            string        key = AccessorKey.GetKey(type, fieldName);

            if (!accessors.TryGetValue(key, out accessor))
            {
                var field = type.GetField(fieldName, BF.Public | BF.NonPublic | BF.Static);
                accessor = (field != null) ? EmitFieldAccesssor(field, type) : defaultAccessor;
                accessors.Add(key, accessor);
            }
            return(accessor());
        }