本文整理汇总了C#中KeyValuePair.ThrowIfNull方法的典型用法代码示例。如果您正苦于以下问题:C# KeyValuePair.ThrowIfNull方法的具体用法?C# KeyValuePair.ThrowIfNull怎么用?C# KeyValuePair.ThrowIfNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyValuePair
的用法示例。
在下文中一共展示了KeyValuePair.ThrowIfNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecorateProperty
public void DecorateProperty(CodeMemberProperty propertyDefinition, KeyValuePair<string, JsonSchema> propertyPair)
{
propertyDefinition.ThrowIfNull("propertyDefinition");
propertyPair.ThrowIfNull("propertyPair");
propertyDefinition.Comments.AddRange(CreateComment(propertyPair.Value));
}
示例2: BaseResource
/// <summary>
/// Creates a new resource for the specified discovery version with the specified name and json dictionary.
/// </summary>
internal BaseResource(DiscoveryVersion version, KeyValuePair<string, object> kvp)
{
kvp.ThrowIfNull("kvp");
kvp.Key.ThrowIfNull("kvp");
DiscoveryVersion = version;
logger.Debug("Constructing Resource [{0}]", kvp.Key);
Name = kvp.Key;
information = kvp.Value as JsonDictionary;
if (information == null)
{
throw new ArgumentException("got no valid dictionary");
}
// Initialize subresources.
if (information.ContainsKey("resources"))
{
var resourceJson = (JsonDictionary)information["resources"];
resources = new Dictionary<string, IResource>();
foreach (KeyValuePair<string, object> pair in resourceJson)
{
// Create the subresource.
var subResource = (BaseResource)CreateResource(pair);
subResource.Parent = this;
resources.Add(pair.Key, subResource);
}
}
}