Anonymous types and Get accessors on WP7.1?

前端 未结 2 765
甜味超标
甜味超标 2020-12-19 02:49

I\'m trying to write a simple object to Dictionary converter like below:

public static class SimplePropertyDictionaryExtensionMethods
{
    public static IDi         


        
2条回答
  •  情书的邮戳
    2020-12-19 03:05

    Remove BindingFlags.GetProperty

    This is used to get a property value when using InvokeMember, it does not specify that you want a read only property returned.

    EDIT: The problem may actually be with the propertyInfo.GetGetMethod() - Try using one of the following (I have only ever used the first one):

    var value = propertyInfo.GetValue(input, null);
    var value = propertyInfo.GetGetMethod().Invoke(input, null); 
    

提交回复
热议问题