internal static Dictionary <XmlQualifiedName, DataContract> GetDataContractsForKnownTypes(IList <Type> knownTypeList) { if (knownTypeList == null) { return(null); } Dictionary <XmlQualifiedName, DataContract> nameToDataContractTable = new Dictionary <XmlQualifiedName, DataContract>(); Dictionary <Type, Type> typesChecked = new Dictionary <Type, Type>(); for (int i = 0; i < knownTypeList.Count; i++) { Type type = knownTypeList[i]; if (type == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.Runtime.Serialization.SR.GetString("NullKnownType", new object[] { "knownTypes" }))); } DataContract.CheckAndAdd(type, typesChecked, ref nameToDataContractTable); } return(nameToDataContractTable); }
internal static DataContractDictionary?GetDataContractsForKnownTypes(IList <Type> knownTypeList) { if (knownTypeList == null) { return(null); } DataContractDictionary dataContracts = new DataContractDictionary(); Dictionary <Type, Type> typesChecked = new Dictionary <Type, Type>(); for (int i = 0; i < knownTypeList.Count; i++) { Type knownType = knownTypeList[i]; if (knownType == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.Format(SR.NullKnownType, "knownTypes"))); } DataContract.CheckAndAdd(knownType, typesChecked, ref dataContracts); } return(dataContracts); }