本文整理汇总了C#中IProjectContent.AddNamespaceContents方法的典型用法代码示例。如果您正苦于以下问题:C# IProjectContent.AddNamespaceContents方法的具体用法?C# IProjectContent.AddNamespaceContents怎么用?C# IProjectContent.AddNamespaceContents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProjectContent
的用法示例。
在下文中一共展示了IProjectContent.AddNamespaceContents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
}
}
示例2: AddNamespaceMembersInAssembly
static void AddNamespaceMembersInAssembly(IProjectContent projectContent, string xmlNamespace, List<ICompletionEntry> list)
{
foreach (IAttribute att in projectContent.GetAssemblyAttributes()) {
if (att.PositionalArguments.Count == 2
&& att.AttributeType.FullyQualifiedName == "System.Windows.Markup.XmlnsDefinitionAttribute") {
string namespaceName = att.PositionalArguments[1] as string;
if (xmlNamespace.Equals(att.PositionalArguments[0]) && namespaceName != null) {
projectContent.AddNamespaceContents(list, namespaceName, projectContent.Language, false);
}
}
}
}