public bool ContainsField(TableField field, bool onlyName = false)
 {
     if (fields == null || fields.Count == 0)
     {
         return(false);
     }
     return(fields.Where(f => f.fieldName == field.fieldName && (onlyName || (f.fieldType == field.fieldType && f.isProperty == field.isProperty))).Count() > 0);
 }
        public void RemoveField(TableField field)
        {
            if (!ContainsField(field, true))
            {
                throw new Exception(string.Format("Table of type {0} doesn't contain a field named {1}", itemType, field.fieldName));
            }
            TableField toRemove = fields.Where(f => f.fieldName == field.fieldName).First();

            fields.Remove(toRemove);
        }
 public void AddField(TableField field, bool replace = false)
 {
     if (ContainsField(field, true))
     {
         if (replace)
         {
             RemoveField(field);
         }
         else
         {
             throw new Exception(string.Format("Table of type {0} already contains a field named {1}", itemType, field.fieldName));
         }
     }
     fields.Add(field);
 }