private static void RemoveTransientAnnotation(ref object transientAnnotations, string namespaceName, string localName) { if (transientAnnotations != null) { IEdmDirectValueAnnotation edmDirectValueAnnotation = transientAnnotations as IEdmDirectValueAnnotation; if (edmDirectValueAnnotation == null) { VersioningList <IEdmDirectValueAnnotation> edmDirectValueAnnotations = (VersioningList <IEdmDirectValueAnnotation>)transientAnnotations; int num = 0; while (num < edmDirectValueAnnotations.Count) { IEdmDirectValueAnnotation item = edmDirectValueAnnotations[num]; if (!(item.NamespaceUri == namespaceName) || !(item.Name == localName)) { num++; } else { edmDirectValueAnnotations = edmDirectValueAnnotations.RemoveAt(num); if (edmDirectValueAnnotations.Count != 1) { transientAnnotations = edmDirectValueAnnotations; return; } else { transientAnnotations = edmDirectValueAnnotations.Single <IEdmDirectValueAnnotation>(); return; } } } } else { if (edmDirectValueAnnotation.NamespaceUri == namespaceName && edmDirectValueAnnotation.Name == localName) { transientAnnotations = null; return; } } } }
private static void RemoveTransientAnnotation(ref object transientAnnotations, string namespaceName, string localName) { if (transientAnnotations != null) { IEdmDirectValueAnnotation singleAnnotation = transientAnnotations as IEdmDirectValueAnnotation; if (singleAnnotation != null) { if (singleAnnotation.NamespaceUri == namespaceName && singleAnnotation.Name == localName) { transientAnnotations = null; return; } } else { VersioningList <IEdmDirectValueAnnotation> annotationsList = (VersioningList <IEdmDirectValueAnnotation>)transientAnnotations; for (int index = 0; index < annotationsList.Count; index++) { IEdmDirectValueAnnotation existingAnnotation = annotationsList[index]; if (existingAnnotation.NamespaceUri == namespaceName && existingAnnotation.Name == localName) { annotationsList = annotationsList.RemoveAt(index); if (annotationsList.Count == 1) { transientAnnotations = annotationsList.Single(); } else { transientAnnotations = annotationsList; } return; } } } } }