本文整理汇总了C#中WritingSystemDefinition.ValidateLanguageTag方法的典型用法代码示例。如果您正苦于以下问题:C# WritingSystemDefinition.ValidateLanguageTag方法的具体用法?C# WritingSystemDefinition.ValidateLanguageTag怎么用?C# WritingSystemDefinition.ValidateLanguageTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WritingSystemDefinition
的用法示例。
在下文中一共展示了WritingSystemDefinition.ValidateLanguageTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
/// <summary>
/// The "oldFileReader" parameter allows the LdmldataMapper to allow data that it doesn't understand to be roundtripped.
/// </summary>
/// <param name="xmlWriter"></param>
/// <param name="ws"></param>
/// <param name="oldFileReader"></param>
public void Write(XmlWriter xmlWriter, WritingSystemDefinition ws, XmlReader oldFileReader)
{
if (xmlWriter == null)
{
throw new ArgumentNullException("xmlWriter");
}
if (ws == null)
{
throw new ArgumentNullException("ws");
}
// We don't want to run any risk of persisting an invalid writing system in an LDML.
string message;
if (!ws.ValidateLanguageTag(out message))
throw new ArgumentException(string.Format("The writing system's IETF language tag is invalid: {0}", message), "ws");
XElement element = oldFileReader != null ? XElement.Load(oldFileReader) : new XElement("ldml");
WriteLdml(xmlWriter, element, ws);
}