当前位置: 首页>>代码示例>>C#>>正文


C# IProjectContent.GetNamespaceContents方法代码示例

本文整理汇总了C#中IProjectContent.GetNamespaceContents方法的典型用法代码示例。如果您正苦于以下问题:C# IProjectContent.GetNamespaceContents方法的具体用法?C# IProjectContent.GetNamespaceContents怎么用?C# IProjectContent.GetNamespaceContents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IProjectContent的用法示例。


在下文中一共展示了IProjectContent.GetNamespaceContents方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddUsing

		public static void AddUsing(List<ICompletionEntry> result, IUsing u, IProjectContent projectContent)
		{
			if (u == null) {
				return;
			}
			bool importNamespaces = projectContent.Language.ImportNamespaces;
			bool importClasses = projectContent.Language.CanImportClasses;
			foreach (string name in u.Usings) {
				if (importClasses) {
					IClass c = projectContent.GetClass(name, 0);
					if (c != null) {
						ArrayList members = new ArrayList();
						IReturnType t = c.DefaultReturnType;
						members.AddRange(t.GetMethods());
						members.AddRange(t.GetFields());
						members.AddRange(t.GetEvents());
						members.AddRange(t.GetProperties());
						foreach (IMember m in members) {
							if (m.IsStatic && m.IsPublic) {
								result.Add(m);
							}
						}
						continue;
					}
				}
				if (importNamespaces) {
					string newName = null;
					if (projectContent.DefaultImports != null) {
						newName = projectContent.DefaultImports.SearchNamespace(name);
					}
					projectContent.AddNamespaceContents(result, newName ?? name, projectContent.Language, true);
				} else {
					foreach (ICompletionEntry o in projectContent.GetNamespaceContents(name)) {
						if (!(o is NamespaceEntry))
							result.Add(o);
					}
				}
			}
			if (u.HasAliases) {
				foreach (string alias in u.Aliases.Keys) {
					result.Add(new AliasEntry(alias));
				}
			}
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:44,代码来源:CtrlSpaceResolveHelper.cs

示例2: GetNamespaceMembers

		public static IEnumerable<IClass> GetNamespaceMembers(IProjectContent pc, string xmlNamespace)
		{
			if (pc == null)
				throw new ArgumentNullException("pc");
			
			if (!string.IsNullOrEmpty(xmlNamespace)) {
				if (xmlNamespace.StartsWith("clr-namespace:", StringComparison.OrdinalIgnoreCase))
					return pc.GetNamespaceContents(GetNamespaceNameFromClrNamespace(xmlNamespace)).OfType<IClass>();
				else {
					var list = new List<ICompletionEntry>();
					AddNamespaceMembersInAssembly(pc, xmlNamespace, list);
					foreach (IProjectContent p in pc.ThreadSafeGetReferencedContents()) {
						AddNamespaceMembersInAssembly(p, xmlNamespace, list);
					}
					return list.OfType<IClass>();
				}
			}
			
			return Enumerable.Empty<IClass>();
		}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:20,代码来源:XamlCompilationUnit.cs

示例3: AddContentsFromCallingClass

		static void AddContentsFromCallingClass(List<ICompletionEntry> result, IProjectContent projectContent, IClass callingClass)
		{
			if (callingClass == null) {
				return;
			}
			// use HashSet so that Contains lookups are possible in O(1).
			HashSet<ICompletionEntry> existingResults = new HashSet<ICompletionEntry>(result);
			string[] namespaceParts = callingClass.Namespace.Split('.');
			for (int i = 1; i <= namespaceParts.Length; i++) {
				foreach (ICompletionEntry member in projectContent.GetNamespaceContents(string.Join(".", namespaceParts, 0, i))) {
					if (!existingResults.Contains(member))
						result.Add(member);
				}
			}
			IClass currentClass = callingClass;
			do {
				foreach (IClass innerClass in currentClass.GetCompoundClass().GetAccessibleTypes(currentClass)) {
					if (!existingResults.Contains(innerClass))
						result.Add(innerClass);
				}
				currentClass = currentClass.DeclaringType;
			} while (currentClass != null);
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:23,代码来源:CtrlSpaceResolveHelper.cs

示例4: GetCompletionData

		public override ArrayList GetCompletionData(IProjectContent projectContent)
		{
			return projectContent.GetNamespaceContents(name);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:4,代码来源:ResolveResult.cs


注:本文中的IProjectContent.GetNamespaceContents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。