| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System.Globalization; |
| | | 5 | | |
| | | 6 | | namespace CoreWCF |
| | | 7 | | { |
| | | 8 | | public class FaultReasonText |
| | | 9 | | { |
| | 242 | 10 | | public FaultReasonText(string text) |
| | | 11 | | { |
| | 242 | 12 | | Text = text ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(text)); |
| | 242 | 13 | | XmlLang = CultureInfo.CurrentCulture.Name; |
| | 242 | 14 | | } |
| | | 15 | | |
| | 184 | 16 | | public FaultReasonText(string text, string xmlLang) |
| | | 17 | | { |
| | 184 | 18 | | Text = text ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(text)); |
| | 184 | 19 | | XmlLang = xmlLang ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(xmlLang)); |
| | 184 | 20 | | } |
| | | 21 | | |
| | | 22 | | // public on full framework |
| | 69 | 23 | | internal FaultReasonText(string text, CultureInfo cultureInfo) |
| | | 24 | | { |
| | 69 | 25 | | if (cultureInfo == null) |
| | | 26 | | { |
| | 0 | 27 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(cultureInfo)); |
| | | 28 | | } |
| | | 29 | | |
| | 69 | 30 | | Text = text ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(text)); |
| | 69 | 31 | | XmlLang = cultureInfo.Name; |
| | 69 | 32 | | } |
| | | 33 | | |
| | | 34 | | public bool Matches(CultureInfo cultureInfo) |
| | | 35 | | { |
| | 8 | 36 | | if (cultureInfo == null) |
| | | 37 | | { |
| | 0 | 38 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(cultureInfo)); |
| | | 39 | | } |
| | | 40 | | |
| | 8 | 41 | | return XmlLang == cultureInfo.Name; |
| | | 42 | | } |
| | | 43 | | |
| | 427 | 44 | | public string XmlLang { get; } |
| | | 45 | | |
| | 471 | 46 | | public string Text { get; } |
| | | 47 | | } |
| | | 48 | | } |