CopyTo() public méthode

public CopyTo ( string fileNames, int start ) : void
fileNames string
start int
Résultat void
		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 ();
		}
Exemple #2
0
        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;
        }
        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]);
            }
        }