CopyTo() public method

public CopyTo ( string fileNames, int start ) : void
fileNames string
start int
return void
コード例 #1
0
		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
0
ファイル: IACodeProvider.cs プロジェクト: lnsoso/IronAHK
        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
0
        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]);
            }
        }