protected override void FullyParse() { if (!string.IsNullOrEmpty(Value)) { var fields = Value.TrimEnd(Encoding.FieldSeparator).Split(Encoding.FieldSeparator).ToList(); Fields.Clear(); for (int i = 0; i < fields.Count; i++) { string field = fields[i]; if (Name == "MSH" && i == 1) { Fields.Add(Hl7Field.Parse(field, Encoding, doNotEscape: true)); } else { Fields.Add(Hl7Field.Parse(field, Encoding)); } } IsParsed = true; Value = null; } }
public override Hl7Element this[int i] { get { EnsureFullyParsed(); if (Fields.Count > i) { return(Fields[i]); } var field = Hl7Field.Parse("", Encoding); this[i] = field; return(field); } set { EnsureFullyParsed(); for (int j = Fields.Count; j <= i; j++) { Fields.Add(new Hl7Field()); } Fields[i] = (Hl7Field)value; } }
public static Hl7Segment operator +(Hl7Segment segment, string field) { segment += Hl7Field.Parse(field, segment.Encoding); return(segment); }