ComContractElementCollection.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. //------------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------------------------
  4. namespace System.ServiceModel.Configuration
  5. {
  6. using System.Collections;
  7. using System.Configuration;
  8. using System.Globalization;
  9. [ConfigurationCollection(typeof(ComContractElement), AddItemName = ConfigurationStrings.ComContract)]
  10. public sealed class ComContractElementCollection : ServiceModelEnhancedConfigurationElementCollection<ComContractElement>
  11. {
  12. public ComContractElementCollection()
  13. : base(ConfigurationStrings.ComContract)
  14. { }
  15. protected override bool ThrowOnDuplicate
  16. {
  17. get { return false; }
  18. }
  19. protected override Object GetElementKey(ConfigurationElement element)
  20. {
  21. if (element == null)
  22. {
  23. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element");
  24. }
  25. ComContractElement configElementKey = (ComContractElement)element;
  26. return configElementKey.Contract;
  27. }
  28. }
  29. }