本文整理汇总了C#中System.Compiler.TypeNode.GetNamespace方法的典型用法代码示例。如果您正苦于以下问题:C# TypeNode.GetNamespace方法的具体用法?C# TypeNode.GetNamespace怎么用?C# TypeNode.GetNamespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Compiler.TypeNode
的用法示例。
在下文中一共展示了TypeNode.GetNamespace方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsRequiredType
//=====================================================================
/// <summary>
/// Check to see if the type is required or not by this entry
/// </summary>
/// <param name="type">The type to check</param>
/// <returns>Null if the type is not within the namespace of this entry, true if it is and it is required
/// or false if it is and it is not required.</returns>
public bool? IsRequiredType(TypeNode type)
{
if(this.IsExposedNamespace(type.GetNamespace()) != null)
{
foreach(TypeFilter typeFilter in typeFilters)
{
bool? result = typeFilter.IsRequiredType(type);
if(result != null)
return result;
}
// No filters match so it's not required
return false;
}
return null;
}
示例2: HasExposedMembers
/// <summary>
/// This is used to find out if the given type is in this namespace and has any exposed members
/// </summary>
/// <param name="type">The type to check</param>
/// <returns>True if the type is in this namespace and has exposed members, false if not</returns>
public bool HasExposedMembers(TypeNode type)
{
if(this.IsExposedNamespace(type.GetNamespace()) != null)
foreach(TypeFilter typeFilter in typeFilters)
{
bool? result = typeFilter.IsExposedType(type);
if(result != null)
return typeFilter.HasExposedMembers(type);
}
return false;
}
示例3: WriteTypeContainers
/// <summary>
/// Write out type containers
/// </summary>
/// <param name="type">The type for which to write out containers</param>
private void WriteTypeContainers(TypeNode type)
{
writer.WriteStartElement("containers");
this.WriteLibraryReference(type.DeclaringModule);
this.WriteNamespaceReference(type.GetNamespace());
// For nested types, record outer types
TypeNode outer = type.DeclaringType;
if(outer != null)
this.WriteTypeReference(outer);
writer.WriteEndElement();
}
示例4: IsExposedType
/// <summary>
/// Check to see if the type is exposed or not by this entry
/// </summary>
/// <param name="type">The type to check</param>
/// <returns>Null if the type is not within the namespace of this entry, true if it is and it is exposed
/// or false if it is and it is not exposed.</returns>
public bool? IsExposedType(TypeNode type)
{
if(this.IsExposedNamespace(type.GetNamespace()) != null)
{
foreach(TypeFilter typeFilter in typeFilters)
{
bool? result = typeFilter.IsExposedType(type);
if(result != null)
return result;
}
// No filter matches for this type, check the parents since it could be nested
TypeNode parent = type.DeclaringType;
while(parent != null)
{
bool? parentExposed = this.IsExposedType(parent);
if(parentExposed != null)
return parentExposed;
parent = type.DeclaringType;
}
// No filters match for the parents either, use the namespace setting
return exposed;
}
return null;
}
示例5: WriteMemberContainers
/// <summary>
/// Write out member containers
/// </summary>
/// <param name="type">The declaring type of the member</param>
private void WriteMemberContainers(TypeNode type)
{
writer.WriteStartElement("containers");
this.WriteLibraryReference(type.DeclaringModule);
this.WriteNamespaceReference(type.GetNamespace());
this.WriteTypeReference(type);
writer.WriteEndElement();
}