本文整理汇总了C#中ITypeReference.TypeCode方法的典型用法代码示例。如果您正苦于以下问题:C# ITypeReference.TypeCode方法的具体用法?C# ITypeReference.TypeCode怎么用?C# ITypeReference.TypeCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITypeReference
的用法示例。
在下文中一共展示了ITypeReference.TypeCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitTypeReference
// Returns true if we need to look at the children, false otherwise.
private bool VisitTypeReference(ITypeReference typeReference)
{
if (!this.alreadySeen.Add(typeReference))
{
if (!this.typeReferenceNeedsToken)
{
return false;
}
this.typeReferenceNeedsToken = false;
if (!this.alreadyHasToken.Add(typeReference))
{
return false;
}
RecordTypeReference(typeReference);
return false;
}
INestedTypeReference/*?*/ nestedTypeReference = typeReference.AsNestedTypeReference;
if (this.typeReferenceNeedsToken || nestedTypeReference != null ||
(typeReference.TypeCode(Context) == PrimitiveTypeCode.NotPrimitive && typeReference.AsNamespaceTypeReference != null))
{
ISpecializedNestedTypeReference/*?*/ specializedNestedTypeReference = (nestedTypeReference == null ? null :
nestedTypeReference.AsSpecializedNestedTypeReference);
if (specializedNestedTypeReference != null)
{
INestedTypeReference unspecializedNestedTypeReference = specializedNestedTypeReference.UnspecializedVersion;
if (this.alreadyHasToken.Add(unspecializedNestedTypeReference))
{
RecordTypeReference(unspecializedNestedTypeReference);
}
}
if (this.typeReferenceNeedsToken && this.alreadyHasToken.Add(typeReference))
{
RecordTypeReference(typeReference);
}
if (nestedTypeReference != null)
{
this.typeReferenceNeedsToken = (typeReference.AsSpecializedNestedTypeReference == null);
this.Visit(nestedTypeReference.GetContainingType(Context));
}
}
//This code was in CCI, but appears wrong to me. There is no need to visit attributes of types that are
//being referenced, only those being defined. This code causes additional spurious typerefs and memberrefs to be
//emitted. If the attributes can't be resolved, it causes a NullReference.
//
//if ((typeReference.AsTypeDefinition(Context) == null))
//{
// this.Visit(typeReference.GetAttributes(Context));
//}
this.typeReferenceNeedsToken = false;
return true;
}