示例#1
0
        //Метод считывания из нескольких файлов
        private static void AsyncReadMultiplyFiles()
        {
            string[] files = {"../../Program.cs", 
                              "../../AsyncWait.csproj", 
                              "../../Properties/AssemblyInfo.cs"};
            AsyncReader[] asrArr = new AsyncReader[3];
            for (int i = 0; i < asrArr.Length; ++i)
                asrArr[i] = new AsyncReader(new FileStream(files[i], FileMode.Open, FileAccess.Read,
                                                    FileShare.Read, 1024, FileOptions.Asynchronous), 100);

            foreach (AsyncReader asr in asrArr)
                Console.WriteLine(asr.EndRead());
        }
示例#2
0
        //Метод считывания из нескольких файлов
        private static void AsyncReadMultiplyFiles()
        {
            string[]      files = { "../../Program.cs",
                                    "../../AsyncWait.csproj",
                                    "../../Properties/AssemblyInfo.cs" };
            AsyncReader[] asrArr = new AsyncReader[3];
            for (int i = 0; i < asrArr.Length; ++i)
            {
                asrArr[i] = new AsyncReader(new FileStream(files[i], FileMode.Open, FileAccess.Read,
                                                           FileShare.Read, 1024, FileOptions.Asynchronous), 100);
            }

            foreach (AsyncReader asr in asrArr)
            {
                Console.WriteLine(asr.EndRead());
            }
        }