本文整理汇总了C#中ImmutableArray.ToCompilationReferencedModulesOnly方法的典型用法代码示例。如果您正苦于以下问题:C# ImmutableArray.ToCompilationReferencedModulesOnly方法的具体用法?C# ImmutableArray.ToCompilationReferencedModulesOnly怎么用?C# ImmutableArray.ToCompilationReferencedModulesOnly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImmutableArray
的用法示例。
在下文中一共展示了ImmutableArray.ToCompilationReferencedModulesOnly方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTypeContext
internal override EvaluationContextBase CreateTypeContext(
DkmClrAppDomain appDomain,
ImmutableArray<MetadataBlock> metadataBlocks,
Guid moduleVersionId,
int typeToken,
bool useReferencedModulesOnly)
{
if (useReferencedModulesOnly)
{
// Avoid using the cache for referenced assemblies only
// since this should be the exceptional case.
var compilation = metadataBlocks.ToCompilationReferencedModulesOnly(moduleVersionId);
return EvaluationContext.CreateTypeContext(
compilation,
moduleVersionId,
typeToken);
}
var previous = appDomain.GetMetadataContext<CSharpMetadataContext>();
var context = EvaluationContext.CreateTypeContext(
previous,
metadataBlocks,
moduleVersionId,
typeToken);
// New type context is not attached to the AppDomain since it is less
// re-usable than the previous attached method context. (We could hold
// on to it if we don't have a previous method context but it's unlikely
// that we evaluated a type-level expression before a method-level.)
Debug.Assert(context != previous.EvaluationContext);
return context;
}
示例2: CreateMethodContext
internal override EvaluationContextBase CreateMethodContext(
DkmClrAppDomain appDomain,
ImmutableArray<MetadataBlock> metadataBlocks,
Lazy<ImmutableArray<AssemblyReaders>> unusedLazyAssemblyReaders,
object symReader,
Guid moduleVersionId,
int methodToken,
int methodVersion,
uint ilOffset,
int localSignatureToken,
bool useReferencedModulesOnly)
{
if (useReferencedModulesOnly)
{
// Avoid using the cache for referenced assemblies only
// since this should be the exceptional case.
var compilation = metadataBlocks.ToCompilationReferencedModulesOnly(moduleVersionId);
return EvaluationContext.CreateMethodContext(
compilation,
symReader,
moduleVersionId,
methodToken,
methodVersion,
ilOffset,
localSignatureToken);
}
var previous = appDomain.GetMetadataContext<CSharpMetadataContext>();
var context = EvaluationContext.CreateMethodContext(
previous,
metadataBlocks,
symReader,
moduleVersionId,
methodToken,
methodVersion,
ilOffset,
localSignatureToken);
if (context != previous.EvaluationContext)
{
appDomain.SetMetadataContext(new CSharpMetadataContext(metadataBlocks, context));
}
return context;
}
示例3: ToCompilation
private static CSharpCompilation ToCompilation(
ImmutableArray<MetadataBlock> blocks,
bool useReferencedModulesOnly,
Guid moduleVersionId)
{
return useReferencedModulesOnly ? blocks.ToCompilationReferencedModulesOnly(moduleVersionId) : blocks.ToCompilation();
}