本文整理汇总了C#中Module.GetNamespaceList方法的典型用法代码示例。如果您正苦于以下问题:C# Module.GetNamespaceList方法的具体用法?C# Module.GetNamespaceList怎么用?C# Module.GetNamespaceList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module.GetNamespaceList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNestedNamespacesAndTypes
protected virtual void GetNestedNamespacesAndTypes(Module module, bool constructorMustBeVisible, bool mustBeAttribute, string nameStr, int nameLen, MemberList members, TrivialHashtable alreadyInList, bool listAllUnderRootNamespace) {
NamespaceList nSpaces = module.GetNamespaceList();
for (int j = 0, m = nSpaces == null ? 0 : nSpaces.Count; j < m; j++){
Namespace ns = nSpaces[j];
if (ns == null) continue;
if (!ns.IsPublic && module != this.currentModule && !this.InternalsAreVisible(this.currentModule, module))
continue;
//TODO: would be nice if namespaces with no attribute types can be eliminated if mustBeAttribute is true.
//(This is hard. The Whidbey C# language service does not manage it either.)
string nsStr = ns.Name.ToString();
if (nsStr.Length <= nameLen) continue;
if (!nsStr.StartsWith(nameStr)) continue;
if (nsStr.StartsWith("<")) continue;
if (nameLen > 0 && nsStr[nameLen] != '.') continue;
int pos = nsStr.IndexOf('.', nameLen+1);
if (pos < 0) pos = nsStr.Length;
if (nameLen == 0) nameLen = -1;
Identifier id = new Identifier(nsStr.Substring(nameLen+1, pos-nameLen-1));
if (alreadyInList[id.UniqueIdKey] != null) continue;
ns = new Namespace(id, Identifier.For(nsStr.Substring(0, pos)), null, null, null, null);
members.Add(ns);
alreadyInList[id.UniqueIdKey] = id;
}
int key = Identifier.For(nameStr).UniqueIdKey;
TypeNodeList types = module.Types;
bool addBecauseUnderRoot = listAllUnderRootNamespace && nameStr != null && nameStr.Length == 0;
for (int i = 1, n = types == null ? 0 : types.Count; i < n; i++){
TypeNode t = types[i];
if (t == null || t.Name == null || t.Namespace == null || (t.Namespace.UniqueIdKey != key && !addBecauseUnderRoot)) continue;
if (t.Template != null) continue;
if (!t.IsPublic && module != this.currentModule && !this.InternalsAreVisible(this.currentModule, module))
continue;
if (t.BaseType == null && t.Namespace == Identifier.Empty) continue;
if (constructorMustBeVisible && this.TypeHasNoVisibleConstructorsOrIsAbstract(t)) continue;
if (mustBeAttribute && !this.GetTypeView(t).IsAssignableTo(SystemTypes.Attribute)) continue;
if (t == SystemTypes.Void) continue;
if (alreadyInList[t.Name.UniqueIdKey] != null) continue;
members.Add(t);
alreadyInList[t.Name.UniqueIdKey] = t;
}
}