本文整理汇总了C#中Mono.CSharp.Namespace.GetNamespace方法的典型用法代码示例。如果您正苦于以下问题:C# Namespace.GetNamespace方法的具体用法?C# Namespace.GetNamespace怎么用?C# Namespace.GetNamespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.Namespace
的用法示例。
在下文中一共展示了Namespace.GetNamespace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImportTypes
protected void ImportTypes (MetaType[] types, Namespace targetNamespace, bool importExtensionTypes)
{
Namespace ns = targetNamespace;
string prev_namespace = null;
foreach (var t in types) {
if (t == null)
continue;
// Be careful not to trigger full parent type loading
if (t.MemberType == MemberTypes.NestedType)
continue;
if (t.Name[0] == '<')
continue;
var it = CreateType (t, null, new DynamicTypeReader (t), true);
if (it == null)
continue;
if (prev_namespace != t.Namespace) {
ns = t.Namespace == null ? targetNamespace : targetNamespace.GetNamespace (t.Namespace, true);
prev_namespace = t.Namespace;
}
// Cannot rely on assembly level Extension attribute or static modifier because they
// are not followed by other compilers (e.g. F#).
if (it.IsClass && it.Arity == 0 && importExtensionTypes &&
HasAttribute (CustomAttributeData.GetCustomAttributes (t), "ExtensionAttribute", CompilerServicesNamespace)) {
it.SetExtensionMethodContainer ();
}
ns.AddType (module, it);
}
}
示例2: ImportTypes
protected void ImportTypes (MetaType[] types, Namespace targetNamespace, bool hasExtensionTypes)
{
Namespace ns = targetNamespace;
string prev_namespace = null;
foreach (var t in types) {
if (t == null)
continue;
// Be careful not to trigger full parent type loading
if (t.MemberType == MemberTypes.NestedType)
continue;
if (t.Name[0] == '<')
continue;
var it = CreateType (t, null, new DynamicTypeReader (t), true);
if (it == null)
continue;
if (prev_namespace != t.Namespace) {
ns = t.Namespace == null ? targetNamespace : targetNamespace.GetNamespace (t.Namespace, true);
prev_namespace = t.Namespace;
}
ns.AddType (module, it);
if (it.IsStatic && hasExtensionTypes &&
HasAttribute (CustomAttributeData.GetCustomAttributes (t), "ExtensionAttribute", CompilerServicesNamespace)) {
it.SetExtensionMethodContainer ();
}
}
}
示例3: ImportTypes
void ImportTypes (Type[] types, Namespace targetNamespace, Type extension_type)
{
Namespace ns = targetNamespace;
string prev_namespace = null;
foreach (var t in types) {
if (t == null)
continue;
// Be careful not to trigger full parent type loading
if (t.MemberType == MemberTypes.NestedType)
continue;
if (t.Name[0] == '<')
continue;
var it = CreateType (t, null, t, 0, true);
if (it == null)
continue;
if (prev_namespace != t.Namespace) {
ns = t.Namespace == null ? targetNamespace : targetNamespace.GetNamespace (t.Namespace, true);
prev_namespace = t.Namespace;
}
ns.AddType (it);
if (it.IsStatic && extension_type != null && t.IsDefined (extension_type, false)) {
it.SetExtensionMethodContainer ();
}
}
}