本文整理汇总了C#中ITypeDefinition.GetNestedTypes方法的典型用法代码示例。如果您正苦于以下问题:C# ITypeDefinition.GetNestedTypes方法的具体用法?C# ITypeDefinition.GetNestedTypes怎么用?C# ITypeDefinition.GetNestedTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITypeDefinition
的用法示例。
在下文中一共展示了ITypeDefinition.GetNestedTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTreeClassContents
static void AddTreeClassContents (TreeStore store, TreeIter parent, ParsedDocument parsedDocument, ITypeDefinition cls, IUnresolvedTypeDefinition part)
{
List<object> items = new List<object> ();
if (cls.Kind != TypeKind.Delegate) {
foreach (var o in cls.GetMembers (m => part.Region.FileName == m.Region.FileName && part.Region.IsInside (m.Region.Begin))) {
items.Add (o);
}
foreach (var o in cls.GetNestedTypes (m => part.Region.FileName == m.Region.FileName && part.Region.IsInside (m.Region.Begin))) {
if (o.DeclaringType == cls)
items.Add (o);
}
foreach (var o in cls.GetConstructors (m => part.Region.FileName == m.Region.FileName && part.Region.IsInside (m.Region.Begin))) {
if (o.IsSynthetic)
continue;
items.Add (o);
}
}
items.Sort (ClassOutlineNodeComparer.CompareRegion);
List<FoldingRegion> regions = new List<FoldingRegion> ();
foreach (FoldingRegion fr in parsedDocument.UserRegions)
//check regions inside class
if (cls.BodyRegion.IsInside (fr.Region.Begin) && cls.BodyRegion.IsInside (fr.Region.End))
regions.Add (fr);
regions.Sort (delegate(FoldingRegion x, FoldingRegion y) { return x.Region.Begin.CompareTo (y.Region.Begin); });
IEnumerator<FoldingRegion> regionEnumerator = regions.GetEnumerator ();
if (!regionEnumerator.MoveNext ())
regionEnumerator = null;
FoldingRegion currentRegion = null;
TreeIter currentParent = parent;
foreach (object item in items) {
//no regions left; quick exit
if (regionEnumerator != null) {
DomRegion itemRegion = ClassOutlineNodeComparer.GetRegion (item);
//advance to a region that could potentially contain this member
while (regionEnumerator != null && !OuterEndsAfterInner (regionEnumerator.Current.Region, itemRegion))
if (!regionEnumerator.MoveNext ())
regionEnumerator = null;
//if member is within region, make sure it's the current parent.
//If not, move target iter back to class parent
if (regionEnumerator != null && regionEnumerator.Current.Region.IsInside (itemRegion.Begin)) {
if (currentRegion != regionEnumerator.Current) {
currentParent = store.AppendValues (parent, regionEnumerator.Current);
currentRegion = regionEnumerator.Current;
}
} else {
currentParent = parent;
}
}
TreeIter childIter = store.AppendValues (currentParent, item);
if (item is ITypeDefinition)
AddTreeClassContents (store, childIter, parsedDocument, (ITypeDefinition)item, part);
}
}
示例2: Visit
public override void Visit(ITypeDefinition typeDefinition)
{
VisitTypeDefinitionNoMembers(typeDefinition);
this.Visit(typeDefinition.Events);
this.Visit(typeDefinition.GetFields(Context));
this.Visit(typeDefinition.GetMethods(Context));
this.VisitNestedTypes(typeDefinition.GetNestedTypes(Context));
this.Visit(typeDefinition.GetProperties(Context));
}