本文整理汇总了C#中Cci.GetContainingType方法的典型用法代码示例。如果您正苦于以下问题:C# Cci.GetContainingType方法的具体用法?C# Cci.GetContainingType怎么用?C# Cci.GetContainingType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cci
的用法示例。
在下文中一共展示了Cci.GetContainingType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitMethodReference
private static void VisitMethodReference(Cci.IMethodReference methodReference, EmitContext context)
{
Debug.Assert(methodReference != null);
// Visit containing type
VisitTypeReference(methodReference.GetContainingType(context), context);
// Visit generic arguments if any
Cci.IGenericMethodInstanceReference genericInstance = methodReference.AsGenericMethodInstanceReference;
if (genericInstance != null)
{
foreach (var arg in genericInstance.GetGenericArguments(context))
{
VisitTypeReference(arg, context);
}
methodReference = genericInstance.GetGenericMethod(context);
}
// Translate substituted method to original definition
Cci.ISpecializedMethodReference specializedMethod = methodReference.AsSpecializedMethodReference;
if (specializedMethod != null)
{
methodReference = specializedMethod.UnspecializedVersion;
}
// Visit parameter types
VisitParameters(methodReference.GetParameters(context), context);
if (methodReference.AcceptsExtraArguments)
{
VisitParameters(methodReference.ExtraParameters, context);
}
// Visit return value type
VisitTypeReference(methodReference.GetType(context), context);
foreach (var typeModifier in methodReference.ReturnValueCustomModifiers)
{
VisitTypeReference(typeModifier.GetModifier(context), context);
}
}
示例2: VisitFieldReference
private static void VisitFieldReference(Cci.IFieldReference fieldReference, EmitContext context)
{
Debug.Assert(fieldReference != null);
// Visit containing type
VisitTypeReference(fieldReference.GetContainingType(context), context);
// Translate substituted field to original definition
Cci.ISpecializedFieldReference specializedField = fieldReference.AsSpecializedFieldReference;
if (specializedField != null)
{
fieldReference = specializedField.UnspecializedVersion;
}
// Visit field type
VisitTypeReference(fieldReference.GetType(context), context);
}