@@ -27,7 +27,7 @@ public static class StaticAccessors
27
27
28
28
public static Func < object , object > GetFastGetter ( this Type type , string propName )
29
29
{
30
- var key = GetTypePropertyKey ( type , propName ) ;
30
+ var key = $ " { type . FullName } :: { propName } " ;
31
31
Func < object , object > fn ;
32
32
if ( getterFnCache . TryGetValue ( key , out fn ) )
33
33
return fn ;
@@ -36,7 +36,7 @@ public static Func<object, object> GetFastGetter(this Type type, string propName
36
36
if ( pi == null )
37
37
return null ;
38
38
39
- fn = GetValueGetter ( pi ) ;
39
+ fn = GetValueGetter ( pi , type ) ;
40
40
41
41
Dictionary < string , Func < object , object > > snapshot , newCache ;
42
42
do
@@ -50,33 +50,11 @@ public static Func<object, object> GetFastGetter(this Type type, string propName
50
50
return fn ;
51
51
}
52
52
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
-
75
53
private static Dictionary < string , Action < object , object > > setterFnCache = new Dictionary < string , Action < object , object > > ( ) ;
76
54
77
55
public static Action < object , object > GetFastSetter ( this Type type , string propName )
78
56
{
79
- var key = GetTypePropertyKey ( type , propName ) ;
57
+ var key = $ " { type . FullName } :: { propName } " ;
80
58
Action < object , object > fn ;
81
59
if ( setterFnCache . TryGetValue ( key , out fn ) )
82
60
return fn ;
@@ -85,7 +63,7 @@ public static Action<object, object> GetFastSetter(this Type type, string propNa
85
63
if ( pi == null )
86
64
return null ;
87
65
88
- fn = GetValueSetter ( pi ) ;
66
+ fn = GetValueSetter ( pi , type ) ;
89
67
90
68
Dictionary < string , Action < object , object > > snapshot , newCache ;
91
69
do
0 commit comments