Exemplo n.º 1
0
        public override bool Equals(object obj)
        {
            if (!(obj is CommonField))
            {
                return(false);
            }
            CommonField other = (CommonField)obj;

            if (!(Name == other.Name && CType == other.CType && HasHeading == other.HasHeading))
            {
                return(false);
            }
            return(!HasHeading || Fields.SequenceEqual(other.Fields));
        }
Exemplo n.º 2
0
 // create a heading minus one field
 public CommonHeading Remove(CommonField field)
 {
     return(CommonHeading.Create(Fields.Where(f => f.Name != field.Name)));
 }
Exemplo n.º 3
0
        // rename a field from old to new
        public CommonHeading Rename(CommonField field1, CommonField field2)
        {
            var fields = Fields.Select(f => (f.Name == field1.Name) ? new CommonField(field2.Name, f.CType) : f);

            return(CommonHeading.Create(fields));
        }
Exemplo n.º 4
0
 // create a heading plus one field
 public CommonHeading Append(CommonField field)
 {
     return(CommonHeading.Create(Fields.Append(field)));
 }
Exemplo n.º 5
0
 public static CommonHeading Create(string heading)
 {
     return(Create(CommonField.ToFields(heading)));
 }