public static SubField[] GetSubField ( [NotNull] this SubFieldCollection subFields, params char[] codes ) { Sure.NotNull(subFields, "subFields"); List <SubField> result = null; int count = subFields.Count; for (int i = 0; i < count; i++) { if (subFields[i].Code.OneOf(codes)) { if (ReferenceEquals(result, null)) { result = new List <SubField>(); } result.Add(subFields[i]); } } return(ReferenceEquals(result, null) ? EmptyArray : result.ToArray()); }
// ReSharper restore InconsistentNaming /// <inheritdoc cref="IReadOnly{T}.AsReadOnly" /> public SubFieldCollection AsReadOnly() { SubFieldCollection result = Clone(); result.SetReadOnly(); return(result); }
public SubFieldCollection Assign ( [NotNull] SubFieldCollection other ) { ThrowIfReadOnly(); Sure.NotNull(other, "other"); Clear(); _field = other.Field; AddRange(other); return(this); }
public static SubFieldCollection FromJson ( [NotNull] string text ) { Sure.NotNullNorEmpty(text, "text"); SubFieldCollection result = JsonConvert.DeserializeObject <SubFieldCollection> ( text ); return(result); }
public SubFieldCollection Clone() { SubFieldCollection result = new SubFieldCollection { _field = Field }; foreach (SubField subField in this) { SubField clone = subField.Clone(); clone.Field = Field; result.Add(clone); } return(result); }
public SubFieldCollection AssignClone ( [NotNull] SubFieldCollection other ) { ThrowIfReadOnly(); Sure.NotNull(other, "other"); Clear(); _field = other.Field; foreach (SubField subField in other) { Add(subField.Clone()); } return(this); }
public static SubField GetFirstSubField ( [NotNull] this SubFieldCollection subFields, char code ) { Sure.NotNull(subFields, "subFields"); int count = subFields.Count; for (int i = 0; i < count; i++) { if (subFields[i].Code.SameChar(code)) { return(subFields[i]); } } return(null); }
public static SubField GetFirstSubField ( [NotNull] this SubFieldCollection subFields, params char[] codes ) { Sure.NotNull(subFields, "subFields"); int count = subFields.Count; for (int i = 0; i < count; i++) { if (subFields[i].Code.OneOf(codes)) { return(subFields[i]); } } return(null); }
public static SubField GetFirstSubField ( [NotNull] this SubFieldCollection subFields, char code, [CanBeNull] string value ) { Sure.NotNull(subFields, "subFields"); int count = subFields.Count; for (int i = 0; i < count; i++) { SubField subField = subFields[i]; if (subField.Code.SameChar(code) && subField.Value.SameStringSensitive(value)) { return(subField); } } return(null); }