diff --git a/Source/Reflection/MemberInfoExtensions.cs b/Source/Reflection/MemberInfoExtensions.cs index 141e9cb..81d56c6 100644 --- a/Source/Reflection/MemberInfoExtensions.cs +++ b/Source/Reflection/MemberInfoExtensions.cs @@ -9,7 +9,7 @@ static class MemberInfoExtensions { delegate object Getter(object source); - static Dictionary getterCache = new Dictionary(); + static readonly Dictionary getterCache = new Dictionary(); public static object GetValue(this MemberInfo self, object target) { switch(self.MemberType) { @@ -23,13 +23,13 @@ public static object GetValue(this MemberInfo self, object target) { } static object ReadField(FieldInfo field, object target) { - var getter = GetGetter(field, name => field.CreateGetter(name)); + var getter = GetGetter(field, field.CreateGetter); return getter(target); } static object InvokeGet(MethodInfo getMethod, object target) { try { - var getter = GetGetter(getMethod, name => getMethod.CreateGetter(name)); + var getter = GetGetter(getMethod, getMethod.CreateGetter); return getter(target); } catch(Exception e) { throw new TargetInvocationException(e); diff --git a/Specs/Cone.Specs/ConeMethodClassifierSpec.cs b/Specs/Cone.Specs/ConeMethodClassifierSpec.cs index 0c24c35..c6bd60b 100644 --- a/Specs/Cone.Specs/ConeMethodClassifierSpec.cs +++ b/Specs/Cone.Specs/ConeMethodClassifierSpec.cs @@ -17,7 +17,7 @@ Mock Classify(MethodInfo method) { return sink; } - MethodInfo Method(Expression> x) { + static MethodInfo Method(Expression> x) { return ((MethodCallExpression)x.Body).Method; }