本文整理匯總了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 ();
}
}
}