本文整理匯總了C#中BEncodedDictionary.TryGetValue方法的典型用法代碼示例。如果您正苦於以下問題:C# BEncodedDictionary.TryGetValue方法的具體用法?C# BEncodedDictionary.TryGetValue怎麽用?C# BEncodedDictionary.TryGetValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BEncodedDictionary
的用法示例。
在下文中一共展示了BEncodedDictionary.TryGetValue方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Initialise
private void Initialise(BEncodedDictionary metadata)
{
Metadata = metadata;
BEncodedValue value;
if (!Metadata.TryGetValue(AnnounceListKey, out value))
{
value = new BEncodedList();
Metadata.Add(AnnounceListKey, value);
}
Announces = new RawTrackerTiers((BEncodedList) value);
if (string.IsNullOrEmpty(Encoding))
Encoding = "UTF-8";
if (InfoDict == null)
InfoDict = new BEncodedDictionary();
}
示例2: GetLong
protected long GetLong(BEncodedDictionary dictionary, BEncodedString key)
{
BEncodedValue value;
if (dictionary.TryGetValue(key, out value))
return ((BEncodedNumber) value).Number;
throw new ArgumentException(string.Format("The value for key {0} was not a BEncodedNumber", key));
}
示例3: GetString
protected string GetString(BEncodedDictionary dictionary, BEncodedString key)
{
BEncodedValue value;
if (dictionary.TryGetValue(key, out value))
return value.ToString();
return "";
}
示例4: GetDictionary
protected BEncodedDictionary GetDictionary(BEncodedDictionary dictionary, BEncodedString key)
{
// // Required? Probably.
// if (dictionary == InfoDict)
// CheckCanEditSecure ();
BEncodedValue value;
if (dictionary.TryGetValue(key, out value))
return (BEncodedDictionary) value;
return null;
}