public Format.Schema.PredicateV1 Serialize() { Format.Schema.PredicateV1 predicate = new Format.Schema.PredicateV1() { Name = this.Name }; var serializedIds = this.Ids.Select(i => i.Serialize()); predicate.Ids.AddRange(serializedIds); return(predicate); }
static public Either <Errors.FormatError, Predicate> DeserializeV1(Format.Schema.PredicateV1 predicate) { IList <ID> ids = new List <ID>(); foreach (Format.Schema.IDV1 id in predicate.Ids) { Either <Errors.FormatError, ID> res = ID.DeserializeEnumV1(id); if (res.IsLeft) { return(res.Left); } else { ids.Add(res.Get()); } } return(new Predicate(predicate.Name, ids)); }