本文整理汇总了C#中TypeInfoProvider.ClearCaches方法的典型用法代码示例。如果您正苦于以下问题:C# TypeInfoProvider.ClearCaches方法的具体用法?C# TypeInfoProvider.ClearCaches怎么用?C# TypeInfoProvider.ClearCaches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeInfoProvider
的用法示例。
在下文中一共展示了TypeInfoProvider.ClearCaches方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ComparisonTest
public ComparisonTest(
EvaluatorPool pool,
IEnumerable<string> filenames, string outputPath,
string[] stubbedAssemblies = null, TypeInfoProvider typeInfo = null,
AssemblyCache assemblyCache = null
)
{
var started = DateTime.UtcNow.Ticks;
OutputPath = outputPath;
EvaluatorPool = pool;
var extensions = (from f in filenames select Path.GetExtension(f).ToLower()).Distinct().ToArray();
var absoluteFilenames = (from f in filenames select Path.Combine(TestSourceFolder, f));
if (extensions.Length != 1)
throw new InvalidOperationException("Mixture of different source languages provided.");
var assemblyNamePrefix = Path.GetDirectoryName(outputPath).Split(new char[] { '\\', '/' }).Last();
var assemblyName = Path.Combine(
assemblyNamePrefix,
Path.GetFileName(outputPath).Replace(".js", "")
);
switch (extensions[0]) {
case ".cs":
Assembly = CompilerUtil.CompileCS(absoluteFilenames, assemblyName);
break;
case ".vb":
Assembly = CompilerUtil.CompileVB(absoluteFilenames, assemblyName);
break;
case ".exe":
case ".dll":
var fns = absoluteFilenames.ToArray();
if (fns.Length > 1)
throw new InvalidOperationException("Multiple binary assemblies provided.");
Assembly = Assembly.LoadFile(fns[0]);
break;
default:
throw new ArgumentException("Unsupported source file type for test");
}
if (typeInfo != null)
typeInfo.ClearCaches();
StubbedAssemblies = stubbedAssemblies;
TypeInfo = typeInfo;
AssemblyCache = assemblyCache;
var ended = DateTime.UtcNow.Ticks;
CompilationElapsed = TimeSpan.FromTicks(ended - started);
}