本文整理汇总了C#中DelegateCollection.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# DelegateCollection.ContainsKey方法的具体用法?C# DelegateCollection.ContainsKey怎么用?C# DelegateCollection.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DelegateCollection
的用法示例。
在下文中一共展示了DelegateCollection.ContainsKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadDelegates
private DelegateCollection ReadDelegates(XPathNavigator specs)
{
DelegateCollection delegates = new DelegateCollection();
foreach (XPathNavigator node in specs.SelectChildren("function", String.Empty))
{
var name = node.GetAttribute("name", String.Empty);
// Check whether we are adding to an existing delegate or creating a new one.
Delegate d = null;
if (delegates.ContainsKey(name))
{
d = delegates[name];
}
else
{
d = new Delegate();
d.Name = name;
d.Version = node.GetAttribute("version", String.Empty);
d.Category = node.GetAttribute("category", String.Empty);
d.DeprecatedVersion = node.GetAttribute("deprecated", String.Empty);
d.Deprecated = !String.IsNullOrEmpty(d.DeprecatedVersion);
d.Obsolete = node.GetAttribute("obsolete", String.Empty);
}
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
{
switch (param.Name)
{
case "returns":
d.ReturnType.CurrentType = param.GetAttribute("type", String.Empty);
break;
case "param":
Parameter p = new Parameter();
p.CurrentType = param.GetAttribute("type", String.Empty);
p.Name = param.GetAttribute("name", String.Empty);
string element_count = param.GetAttribute("elementcount", String.Empty);
if (String.IsNullOrEmpty(element_count))
element_count = param.GetAttribute("count", String.Empty);
if (!String.IsNullOrEmpty(element_count))
p.ElementCount = Int32.Parse(element_count);
p.Flow = Parameter.GetFlowDirection(param.GetAttribute("flow", String.Empty));
d.Parameters.Add(p);
break;
}
}
delegates.Add(d);
}
return delegates;
}
示例2: Merge
/// <summary>
/// Merges the given enum into the enum list. If an enum of the same name exists,
/// it merges their respective constants.
/// </summary>
/// <param name="enums"></param>
/// <param name="t"></param>
internal static void Merge(DelegateCollection delegates, Delegate t)
{
if (!delegates.ContainsKey(t.Name))
{
delegates.Add(t.Name, t);
}
}
示例3: ReadDelegates
public override DelegateCollection ReadDelegates(StreamReader specFile)
{
DelegateCollection delegates = new DelegateCollection();
XPathDocument specs = new XPathDocument(specFile);
XPathDocument overrides = new XPathDocument(new StreamReader(Path.Combine(Settings.InputPath, functionOverridesFile)));
foreach (XPathNavigator nav in new XPathNavigator[] {
specs.CreateNavigator().SelectSingleNode("/signatures"),
overrides.CreateNavigator().SelectSingleNode("/overrides/add") })
{
if (nav != null)
{
foreach (XPathNavigator node in nav.SelectChildren("function", String.Empty))
{
var name = node.GetAttribute("name", String.Empty);
// Check whether we are adding to an existing delegate or creating a new one.
Delegate d = null;
if (delegates.ContainsKey(name))
{
d = delegates[name];
}
else
{
d = new Delegate();
d.Name = name;
d.Version = node.GetAttribute("version", String.Empty);
d.Category = node.GetAttribute("category", String.Empty);
}
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
{
switch (param.Name)
{
case "returns":
d.ReturnType.CurrentType = param.GetAttribute("type", String.Empty);
break;
case "param":
Parameter p = new Parameter();
p.CurrentType = param.GetAttribute("type", String.Empty);
p.Name = param.GetAttribute("name", String.Empty);
string element_count = param.GetAttribute("elementcount", String.Empty);
if (!String.IsNullOrEmpty(element_count))
p.ElementCount = Int32.Parse(element_count);
p.Flow = Parameter.GetFlowDirection(param.GetAttribute("flow", String.Empty));
d.Parameters.Add(p);
break;
}
}
d.Translate(overrides);
delegates.Add(d);
}
}
}
return delegates;
}