MessageParameterAttribute.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //-----------------------------------------------------------------------------
  4. namespace System.ServiceModel
  5. {
  6. using System;
  7. using System.ServiceModel.Channels;
  8. [AttributeUsage(ServiceModelAttributeTargets.Parameter, Inherited = false)]
  9. public sealed class MessageParameterAttribute : Attribute
  10. {
  11. string name;
  12. bool isNameSetExplicit;
  13. internal const string NamePropertyName = "Name";
  14. public string Name
  15. {
  16. get { return name; }
  17. set
  18. {
  19. if (value == null)
  20. {
  21. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value");
  22. }
  23. if (value == string.Empty)
  24. {
  25. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value",
  26. SR.GetString(SR.SFxNameCannotBeEmpty)));
  27. }
  28. name = value; isNameSetExplicit = true;
  29. }
  30. }
  31. internal bool IsNameSetExplicit
  32. {
  33. get { return isNameSetExplicit; }
  34. }
  35. }
  36. }