public static object getObject(FieldInfo fi, string src) { if (ReflecTools.equals(fi, typeof(string))) { return(StringTools.unescape(src)); } if (ReflecTools.equals(fi, typeof(int))) { return(int.Parse(src)); } if (ReflecTools.equals(fi, typeof(long))) { return(long.Parse(src)); } if (ReflecTools.equals(fi, typeof(bool))) { return(StringTools.toFlag(src)); } if (ReflecTools.equalsOrBase(fi, typeof(Serializable))) { object dest = fi.FieldType.InvokeMember(null, BindingFlags.CreateInstance, null, null, null); deserialize(dest, StringTools.decodeLines(src)); return(dest); } throw new Exception("そんなタイプ知りません:" + fi); }
public static object getObject(FieldInfo fi, string src) { if (ReflecTools.equals(fi, typeof(string))) { return(StringTools.unescape(src)); } if (ReflecTools.equals(fi, typeof(int))) { return(int.Parse(src)); } if (ReflecTools.equals(fi, typeof(long))) { return(long.Parse(src)); } if (ReflecTools.equals(fi, typeof(bool))) { return(StringTools.toFlag(src)); } throw new Exception("そんなタイプ知りません:" + fi); }