private static BinaryPropertyInfo GetPropertyWithUniqueAttribute(Type classType, Type attributeType, Dictionary <string, BinaryPropertyInfo> cache) { BinaryPropertyInfo property = null; foreach (BinaryPropertyInfo binaryPropertyInfo in cache.Values) { Debug.Assert(binaryPropertyInfo.MemberInfo != null); Attribute attribute = binaryPropertyInfo.MemberInfo.GetCustomAttribute(attributeType); if (attribute != null) { if (property != null) { ThrowHelper.ThrowInvalidOperationException_SerializationDuplicateTypeAttribute(classType, attributeType); } property = binaryPropertyInfo; } } return(property); }