本文整理汇总了C#中RuleContext.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# RuleContext.GetType方法的具体用法?C# RuleContext.GetType怎么用?C# RuleContext.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RuleContext
的用法示例。
在下文中一共展示了RuleContext.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRuleName
private string GetRuleName(RuleContext context)
{
string classname = context.GetType().Name;
var builder = new StringBuilder(classname);
builder.Length -= "Context".Length;
builder[0] = System.Char.ToLower(classname[0]);
// could have done "RULE_" + builder.ToString(), then find int value of the field of CodeElementsParser
// corresponding to it, then got the exact name in CodeElementsParser.ruleNames, but ... :P
return builder.ToString();
}
示例2: GetRootContext
/// <summary>
/// returns the ancestor node context of a certain type of root from this context
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
RuleContext GetRootContext(RuleContext context, System.Type type)
{
if (context.GetType() == type) return context;
if (context.Parent == null) return null;
return GetRootContext(context.Parent, type);
}
示例3: GetDefaultClassName
/// <summary>
/// returns the ancestor node context of a certain type of root from this context
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
string GetDefaultClassName(RuleContext context)
{
if (context.GetType() == typeof(SelectionContext)) return ((SelectionContext) context).dataObjectClass ().GetText ();
if (context.Parent == null) return null;
return GetDefaultClassName(context.Parent);
}