private static ValueElementIdReferenceAPI FindValueElementIdReferenceForValueElementId(ValueElementIdAPI valueElementId, List <ValueElementIdReferenceAPI> valueElementIdReferences) { ValueElementIdReferenceAPI valueElementIdReference = null; if (valueElementId != null) { if (valueElementIdReferences != null && valueElementIdReferences.Count > 0) { foreach (ValueElementIdReferenceAPI valueElementIdReferenceEntry in valueElementIdReferences) { // For the value element reference to be a match, both the identifier and the type element property identifier must match if (valueElementIdReferenceEntry.id.Equals(valueElementId.id, StringComparison.OrdinalIgnoreCase) == true && ((string.IsNullOrWhiteSpace(valueElementId.typeElementPropertyId) == true && string.IsNullOrWhiteSpace(valueElementIdReferenceEntry.typeElementPropertyId) == true) || (string.IsNullOrWhiteSpace(valueElementId.typeElementPropertyId) == false && string.IsNullOrWhiteSpace(valueElementIdReferenceEntry.typeElementPropertyId) == false && valueElementId.typeElementPropertyId.Equals(valueElementIdReferenceEntry.typeElementPropertyId, StringComparison.OrdinalIgnoreCase) == true))) { valueElementIdReference = valueElementIdReferenceEntry; break; } } } if (valueElementIdReference == null) { // TODO: Warn the author that a reference has gone missing via a notification } } return(valueElementIdReference); }
private static ValueElementIdReferenceAPI FindValueElementIdReferenceForValueElementId(ValueElementIdAPI valueElementId, List <ValueElementIdReferenceAPI> valueElementIdReferences) { ValueElementIdReferenceAPI valueElementIdReference = null; if (valueElementId != null) { if (valueElementIdReferences != null && valueElementIdReferences.Count > 0) { // If we're not given a property ID, then we're looking for a scalar value if (string.IsNullOrWhiteSpace(valueElementId.typeElementPropertyId)) { valueElementIdReference = valueElementIdReferences .Where(valueElementIdReferenceEntry => valueElementIdReferenceEntry.id == valueElementId.id) .FirstOrDefault(); } else { // For the value element reference to be a match, both the identifier and the type element property identifier must match valueElementIdReference = valueElementIdReferences .Where(valueElementIdReferenceEntry => valueElementIdReferenceEntry.id == valueElementId.id) .Where(valueElementIdReferenceEntry => valueElementIdReferenceEntry.typeElementPropertyId == valueElementId.typeElementPropertyId) .FirstOrDefault(); } } if (valueElementIdReference == null) { // TODO: Warn the author that a reference has gone missing via a notification } } return(valueElementIdReference); }