@@ -27,7 +27,7 @@ public static class StaticAccessors
2727
2828 public static Func < object , object > GetFastGetter ( this Type type , string propName )
2929 {
30- var key = GetTypePropertyKey ( type , propName ) ;
30+ var key = $ " { type . FullName } :: { propName } " ;
3131 Func < object , object > fn ;
3232 if ( getterFnCache . TryGetValue ( key , out fn ) )
3333 return fn ;
@@ -36,7 +36,7 @@ public static Func<object, object> GetFastGetter(this Type type, string propName
3636 if ( pi == null )
3737 return null ;
3838
39- fn = GetValueGetter ( pi ) ;
39+ fn = GetValueGetter ( pi , type ) ;
4040
4141 Dictionary < string , Func < object , object > > snapshot , newCache ;
4242 do
@@ -50,33 +50,11 @@ public static Func<object, object> GetFastGetter(this Type type, string propName
5050 return fn ;
5151 }
5252
53- private static string GetTypePropertyKey ( Type type , string propName )
54- {
55- var key = StringBuilderThreadStatic . Allocate ( )
56- . Append ( $ "{ type . Namespace } .{ type . Name } ::{ propName } ") ;
57-
58- if ( type . IsGenericType ( ) )
59- {
60- key . Append ( "<" ) ;
61- var i = 0 ;
62- foreach ( var arg in type . GetGenericArguments ( ) )
63- {
64- if ( i ++ > 0 )
65- key . Append ( "," ) ;
66-
67- key . Append ( $ "{ arg . Namespace } .{ arg . Name } ") ;
68- }
69- key . Append ( ">" ) ;
70- }
71-
72- return StringBuilderThreadStatic . ReturnAndFree ( key ) ;
73- }
74-
7553 private static Dictionary < string , Action < object , object > > setterFnCache = new Dictionary < string , Action < object , object > > ( ) ;
7654
7755 public static Action < object , object > GetFastSetter ( this Type type , string propName )
7856 {
79- var key = GetTypePropertyKey ( type , propName ) ;
57+ var key = $ " { type . FullName } :: { propName } " ;
8058 Action < object , object > fn ;
8159 if ( setterFnCache . TryGetValue ( key , out fn ) )
8260 return fn ;
@@ -85,7 +63,7 @@ public static Action<object, object> GetFastSetter(this Type type, string propNa
8563 if ( pi == null )
8664 return null ;
8765
88- fn = GetValueSetter ( pi ) ;
66+ fn = GetValueSetter ( pi , type ) ;
8967
9068 Dictionary < string , Action < object , object > > snapshot , newCache ;
9169 do
0 commit comments