// ========================================================== public static string GetSubFieldValue ( this SubField subField ) { return(subField == null ? null : subField.Value); }
public static string GetFirstSubFieldValue ( this RecordField field, char code ) { SubField result = field.GetFirstSubField(code); return(ReferenceEquals(result, null) ? null : result.Value); }
// ========================================================== public static RecordField AddSubField ( this RecordField field, char code, string value ) { SubField subField = new SubField { Code = code, Value = value }; field.SubFields.Add(subField); return(field); }
public static SubField[] GetSubField ( this SubFieldCollection subFields, Action <SubField> action ) { int count = subFields.Length; SubField[] result = new SubField[count]; for (int i = 0; i < count; i++) { SubField item = subFields[i]; result[i] = item; action(item); } return(result); }
public static RecordField SetSubField ( this RecordField field, char code, string value ) { SubField subField = field.SubFields .Cast <SubField>() .FirstOrDefault(sub => Utility.SameChar(code, sub.Code)); if (ReferenceEquals(subField, null)) { subField = new SubField { Code = code }; field.SubFields.Add(subField); } subField.Value = value; return(field); }
internal static RecordField Parse(string line) { StringReader reader = new StringReader(line); RecordField result = new RecordField(Utility.ReadTo(reader, '#')); result.Value = Utility.ReadTo(reader, '^'); while (true) { int next = reader.Read(); if (next < 0) { break; } char code = char.ToLower((char)next); string value = Utility.ReadTo(reader, '^'); SubField subField = new SubField(); subField.Code = code; subField.Value = value; result.SubFields.Add(subField); } return(result); }
public void Remove(SubField item) { _list.Remove(item); }
public void Add(SubField item) { _list.Add(item); }