本文整理汇总了C#中System.CodeDom.Compiler.TempFileCollection.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# TempFileCollection.CopyTo方法的具体用法?C# TempFileCollection.CopyTo怎么用?C# TempFileCollection.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.CodeDom.Compiler.TempFileCollection
的用法示例。
在下文中一共展示了TempFileCollection.CopyTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Constructor0_Deny_Unrestricted
public void Constructor0_Deny_Unrestricted ()
{
TempFileCollection tfc = new TempFileCollection ();
Assert.AreEqual (0, tfc.Count, "Count");
Assert.IsFalse (tfc.KeepFiles, "KeepFiles");
Assert.AreEqual (String.Empty, tfc.TempDir, "TempDir");
tfc.AddFile ("main.cs", false);
tfc.CopyTo (array, 0);
tfc.Delete ();
(tfc as IDisposable).Dispose ();
}
示例2: CompileAssemblyFromReader
CompilerResults CompileAssemblyFromReader(CompilerParameters options, params TextReader[] readers)
{
var tempFiles = new TempFileCollection(Path.GetTempPath(), false);
for (int i = 0; i < readers.Length; i++)
{
string file = tempFiles.AddExtension(FileExtension, false);
File.WriteAllText(file, readers[i].ReadToEnd());
}
var fileNames = new string[tempFiles.Count];
tempFiles.CopyTo(fileNames, 0);
var results = CompileAssemblyFromFile(options, fileNames);
tempFiles.Delete();
return results;
}
示例3: CopyTo
public void CopyTo()
{
using (var collection = new TempFileCollection())
{
const int ArrayIndex = 1;
const string FileName = "File";
collection.AddFile(FileName, keepFile: false);
var array = new string[ArrayIndex + collection.Count];
collection.CopyTo(array, ArrayIndex);
Assert.Null(array[0]);
Assert.Equal(FileName, array[ArrayIndex]);
}
}