public Dictionary <string, myPropInfo> Getproperties(Type type, string typename, bool IgnoreCaseOnDeserialize, bool customType)
{
Dictionary <string, myPropInfo> sd = null;
if (_propertycache.TryGetValue(typename, out sd))
{
return(sd);
}
else
{
sd = new Dictionary <string, myPropInfo>();
PropertyInfo[] pr = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
foreach (PropertyInfo p in pr)
{
myPropInfo d = CreateMyProp(p.PropertyType, p.Name, customType);
//if (p.CanWrite)
// d.Flags |= myPropInfoFlags.CanWrite;
d.setter = Reflection.CreateSetMethod(type, p);
if (d.setter != null)
{
d.CanWrite = true;// Flags |= myPropInfoFlags.CanWrite;
}
d.getter = Reflection.CreateGetMethod(type, p);
if (IgnoreCaseOnDeserialize)
{
sd.Add(p.Name.ToLower(), d);
}
else
{
sd.Add(p.Name, d);
}
}
FieldInfo[] fi = type.GetFields(BindingFlags.Public | BindingFlags.Instance);
foreach (FieldInfo f in fi)
{
myPropInfo d = CreateMyProp(f.FieldType, f.Name, customType);
d.CanWrite = true;// Flags |= myPropInfoFlags.CanWrite;
d.setter = Reflection.CreateSetField(type, f);
d.getter = Reflection.CreateGetField(type, f);
if (IgnoreCaseOnDeserialize)
{
sd.Add(f.Name.ToLower(), d);
}
else
{
sd.Add(f.Name, d);
}
}
_propertycache.Add(typename, sd);
return(sd);
}
}