本文整理汇总了C#中IXmlDictionary.TryLookup方法的典型用法代码示例。如果您正苦于以下问题:C# IXmlDictionary.TryLookup方法的具体用法?C# IXmlDictionary.TryLookup怎么用?C# IXmlDictionary.TryLookup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IXmlDictionary
的用法示例。
在下文中一共展示了IXmlDictionary.TryLookup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetValue
public string GetValue(IXmlDictionary staticDictionary, XmlBinaryReaderSession readerSession)
{
int id = this.DictionaryId / 2;
XmlDictionaryString dicString = XmlDictionaryString.Empty;
bool found;
if (this.IsSession)
{
if (readerSession == null)
{
return null;
}
found = readerSession.TryLookup(id, out dicString);
}
else
{
if (staticDictionary == null)
{
return null;
}
found = staticDictionary.TryLookup(id, out dicString);
}
if (found)
{
return dicString.Value;
}
else
{
throw new ArgumentException("Cannot find value for dictionary string with ID = " + this.DictionaryId);
}
}
示例2: LookupDictionaryString
private XmlDictionaryString LookupDictionaryString(IXmlDictionary dictionary, string value)
{
XmlDictionaryString str;
if (!dictionary.TryLookup(value, out str))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("XDCannotFindValueInDictionaryString", new object[] { value }));
}
return str;
}
示例3: LookupDictionaryString
XmlDictionaryString LookupDictionaryString(IXmlDictionary dictionary, string value)
{
XmlDictionaryString expectedValue;
if (!dictionary.TryLookup(value, out expectedValue))
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.XDCannotFindValueInDictionaryString, value));
return expectedValue;
}