本文整理汇总了C#中ICSharpCode.NRefactory.CSharp.EntityDeclaration.GetChildByRole方法的典型用法代码示例。如果您正苦于以下问题:C# EntityDeclaration.GetChildByRole方法的具体用法?C# EntityDeclaration.GetChildByRole怎么用?C# EntityDeclaration.GetChildByRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.NRefactory.CSharp.EntityDeclaration
的用法示例。
在下文中一共展示了EntityDeclaration.GetChildByRole方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckBody
static bool CheckBody(EntityDeclaration node)
{
var custom = node as CustomEventDeclaration;
if (custom != null && !(IsValidBody (custom.AddAccessor.Body) || IsValidBody (custom.RemoveAccessor.Body)))
return false;
if (node is PropertyDeclaration || node is IndexerDeclaration) {
var setter = node.GetChildByRole(PropertyDeclaration.SetterRole);
var getter = node.GetChildByRole(PropertyDeclaration.GetterRole);
return IsValidBody(setter.Body) && IsValidBody(getter.Body);
}
return IsValidBody(node.GetChildByRole(Roles.Body));
}
示例2: ImplementStub
static ThrowStatement ImplementStub (RefactoringContext context, EntityDeclaration newNode)
{
ThrowStatement throwStatement = null;
if (newNode is PropertyDeclaration || newNode is IndexerDeclaration) {
var setter = newNode.GetChildByRole(PropertyDeclaration.SetterRole);
if (!setter.IsNull)
setter.AddChild(CreateNotImplementedBody(context, out throwStatement), Roles.Body);
var getter = newNode.GetChildByRole(PropertyDeclaration.GetterRole);
if (!getter.IsNull)
getter.AddChild(CreateNotImplementedBody(context, out throwStatement), Roles.Body);
} else {
newNode.AddChild(CreateNotImplementedBody(context, out throwStatement), Roles.Body);
}
return throwStatement;
}