FaultReasonText.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------
  4. namespace System.ServiceModel
  5. {
  6. using System.Globalization;
  7. using System.Threading;
  8. public class FaultReasonText
  9. {
  10. string xmlLang;
  11. string text;
  12. public FaultReasonText(string text)
  13. {
  14. if (text == null)
  15. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("text"));
  16. this.text = text;
  17. this.xmlLang = CultureInfo.CurrentCulture.Name;
  18. }
  19. public FaultReasonText(string text, string xmlLang)
  20. {
  21. if (text == null)
  22. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("text"));
  23. if (xmlLang == null)
  24. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("xmlLang"));
  25. this.text = text;
  26. this.xmlLang = xmlLang;
  27. }
  28. public FaultReasonText(string text, CultureInfo cultureInfo)
  29. {
  30. if (text == null)
  31. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("text"));
  32. if (cultureInfo == null)
  33. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("cultureInfo"));
  34. this.text = text;
  35. this.xmlLang = cultureInfo.Name;
  36. }
  37. public bool Matches(CultureInfo cultureInfo)
  38. {
  39. if (cultureInfo == null)
  40. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("cultureInfo"));
  41. return xmlLang == cultureInfo.Name;
  42. }
  43. public string XmlLang
  44. {
  45. get { return xmlLang; }
  46. }
  47. public string Text
  48. {
  49. get { return text; }
  50. }
  51. }
  52. }