public static NameValueObjectList FromCollection <T> (List <T> col)
        {
            Type t    = typeof(T);
            var  nvol = new NameValueObjectList();

            nvol.ObjectName = t.Name;
            nvol.Items      = new List <NameValueObject> ();
            col.ForEach(i => nvol.Items.Add(NameValueObject.FromObject <T> (i)));
            return(nvol);
        }
        public static NameValueObject FromObject <T>(T obj)
        {
            Type t     = typeof(T);
            var  nvo   = new NameValueObject(t.Name);
            var  props = t.GetProperties(BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);

            props.ToList().ForEach(p =>
            {
                var val = p.GetValue(obj, null);
                if ((val is Int32) || (val is Int16))
                {
                    nvo.Properties.Add(p.Name, (Int32)val);
                }
                else if (val is string)
                {
                    var value = (string)val;
                    if (value.Contains("\0"))
                    {
                        value = value.Replace("\0", "");
                    }
                    nvo.Properties.Add(p.Name, value == null ? "" : value.Trim());
                }
                else if (val is bool)
                {
                    nvo.Properties.Add(p.Name, (bool)val);
                }
                else if (val is double)
                {
                    nvo.Properties.Add(p.Name, (double)val);
                }
                else if (val is DateTime)
                {
                    nvo.Properties.Add(p.Name, (DateTime)val);
                }
            });
            return(nvo);
        }