本文整理汇总了C#中TypeSymbol.IsFromCompilation方法的典型用法代码示例。如果您正苦于以下问题:C# TypeSymbol.IsFromCompilation方法的具体用法?C# TypeSymbol.IsFromCompilation怎么用?C# TypeSymbol.IsFromCompilation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeSymbol
的用法示例。
在下文中一共展示了TypeSymbol.IsFromCompilation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MightContainReferences
/// <summary>
/// Might the given type be, or contain, managed references? This is used to determine which
/// fields allocated to temporaries should be cleared when the underlying variable goes out of scope, so
/// that they do not cause unnecessary object retention.
/// </summary>
private bool MightContainReferences(TypeSymbol type)
{
if (type.IsReferenceType || type.TypeKind == TypeKind.TypeParameter) return true; // type parameter or reference type
if (type.TypeKind != TypeKind.Struct) return false; // enums, etc
if (type.SpecialType == SpecialType.System_TypedReference) return true;
if (type.SpecialType != SpecialType.None) return false; // int, etc
if (!type.IsFromCompilation(this.CompilationState.ModuleBuilderOpt.Compilation)) return true; // perhaps from ref assembly
foreach (var f in _emptyStructTypeCache.GetStructInstanceFields(type))
{
if (MightContainReferences(f.Type)) return true;
}
return false;
}