Example #1
0
    internal virtual IDictionary <string, ReflectionsUtils.GetDelegate> GetterValueFactory(Type type)
    {
        IDictionary <string, ReflectionsUtils.GetDelegate> dictionary = new Dictionary <string, ReflectionsUtils.GetDelegate>();

        foreach (PropertyInfo current in ReflectionsUtils.GetProperties(type))
        {
            if (current.CanRead)
            {
                MethodInfo getterMethodInfo = ReflectionsUtils.GetGetterMethodInfo(current);
                if (!getterMethodInfo.IsStatic && getterMethodInfo.IsPublic)
                {
                    dictionary[this.MapClrMemberNameToJsonFieldName(current.Name)] = ReflectionsUtils.GetGetMethod(current);
                }
            }
        }
        foreach (FieldInfo current2 in ReflectionsUtils.GetFields(type))
        {
            if (!current2.IsStatic && current2.IsPublic)
            {
                dictionary[this.MapClrMemberNameToJsonFieldName(current2.Name)] = ReflectionsUtils.GetGetMethod(current2);
            }
        }
        return(dictionary);
    }