@@ -12,7 +12,7 @@ namespace Monaco.Helpers
12
12
public sealed class ParentAccessor
13
13
{
14
14
private object parent ;
15
- private TypeInfo typeinfo ;
15
+ private Type typeinfo ;
16
16
private Dictionary < string , Action > actions ;
17
17
18
18
/// <summary>
@@ -22,7 +22,7 @@ public sealed class ParentAccessor
22
22
public ParentAccessor ( object parent )
23
23
{
24
24
this . parent = parent ;
25
- this . typeinfo = parent . GetType ( ) . GetTypeInfo ( ) ;
25
+ this . typeinfo = parent . GetType ( ) ;
26
26
this . actions = new Dictionary < string , Action > ( ) ;
27
27
}
28
28
@@ -59,7 +59,7 @@ public bool CallAction(string name)
59
59
/// <returns>Property Value or null.</returns>
60
60
public object GetValue ( string name )
61
61
{
62
- var propinfo = typeinfo . GetDeclaredProperty ( name ) ;
62
+ var propinfo = typeinfo . GetProperty ( name ) ;
63
63
return propinfo ? . GetValue ( this . parent ) ;
64
64
}
65
65
@@ -73,11 +73,12 @@ public object GetValue(string name)
73
73
/// <returns>Value of Child Property or null.</returns>
74
74
public object GetChildValue ( string name , string child )
75
75
{
76
- var propinfo = typeinfo . GetDeclaredProperty ( name ) ;
76
+ // TODO: Support params for multi-level digging?
77
+ var propinfo = typeinfo . GetProperty ( name ) ;
77
78
var prop = propinfo ? . GetValue ( this . parent ) ;
78
79
if ( prop != null )
79
80
{
80
- var childinfo = prop . GetType ( ) . GetTypeInfo ( ) . GetDeclaredProperty ( child ) ;
81
+ var childinfo = prop . GetType ( ) . GetProperty ( child ) ;
81
82
return childinfo ? . GetValue ( prop ) ;
82
83
}
83
84
@@ -91,7 +92,7 @@ public object GetChildValue(string name, string child)
91
92
/// <param name="value">Value to set.</param>
92
93
public void SetValue ( string name , object value )
93
94
{
94
- var propinfo = typeinfo . GetDeclaredProperty ( name ) ; // TODO: Cache these?
95
+ var propinfo = typeinfo . GetProperty ( name ) ; // TODO: Cache these?
95
96
propinfo ? . SetValue ( this . parent , value ) ;
96
97
}
97
98
}
0 commit comments