資源簡介
假設有一個10G大小的文本文件,要求編寫程序統計其中每個字符出現的次數
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.IO;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
namespace?work2
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????string?path?=?textBox1.Text;
????????????#region?創建測試用目錄
????????????string?thispath?=?Directory.GetCurrentDirectory()?+?@“\path\“;
????????????if?(!Directory.Exists(thispath))?//創建目錄
????????????{
????????????????Directory.CreateDirectory(thispath);
????????????}
????????????else?//清空目錄
????????????{
????????????????DirectoryInfo?dir?=?new?DirectoryInfo(thispath);
????????????????FileSystemInfo[]?fileinfo?=?dir.GetFileSystemInfos();
????????????????foreach?(FileSystemInfo?item?in?fileinfo)
??????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-03-16?16:55??work2\
?????目錄???????????0??2018-03-17?14:58??work2\work2\
?????文件?????????984??2018-03-16?16:55??work2\work2.sln
?????文件???????31232??2018-03-17?14:40??work2\work2.v12.suo
?????文件?????????187??2018-03-16?16:55??work2\work2\App.config
?????目錄???????????0??2018-03-16?16:55??work2\work2\bin\
?????目錄???????????0??2018-03-17?14:42??work2\work2\bin\Debug\
?????目錄???????????0??2018-03-17?14:57??work2\work2\bin\Debug\path\
?????文件???????10752??2018-03-17?14:57??work2\work2\bin\Debug\work2.exe
?????文件?????????187??2018-03-16?16:55??work2\work2\bin\Debug\work2.exe.config
?????文件???????26112??2018-03-17?14:57??work2\work2\bin\Debug\work2.pdb
?????文件???????23168??2018-03-17?14:58??work2\work2\bin\Debug\work2.vshost.exe
?????文件?????????187??2018-03-16?16:55??work2\work2\bin\Debug\work2.vshost.exe.config
?????文件?????????490??2017-09-29?21:43??work2\work2\bin\Debug\work2.vshost.exe.manifest
?????文件????????4466??2018-03-17?14:58??work2\work2\Form1.cs
?????文件????????2569??2018-03-17?14:58??work2\work2\Form1.Designer.cs
?????文件????????5817??2018-03-17?14:58??work2\work2\Form1.resx
?????目錄???????????0??2018-03-16?16:55??work2\work2\obj\
?????目錄???????????0??2018-03-17?14:57??work2\work2\obj\Debug\
?????文件????????1453??2018-03-17?11:03??work2\work2\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件????????6883??2018-03-16?17:06??work2\work2\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件???????????0??2018-03-16?16:55??work2\work2\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件???????????0??2018-03-16?16:55??work2\work2\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件???????????0??2018-03-16?16:55??work2\work2\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
?????目錄???????????0??2018-03-16?16:55??work2\work2\obj\Debug\TempPE\
?????文件?????????474??2018-03-17?14:58??work2\work2\obj\Debug\work2.csproj.FileListAbsolute.txt
?????文件?????????977??2018-03-17?14:40??work2\work2\obj\Debug\work2.csproj.GenerateResource.Cache
?????文件????????2211??2018-03-16?17:11??work2\work2\obj\Debug\work2.csprojResolveAssemblyReference.cache
?????文件???????10752??2018-03-17?14:57??work2\work2\obj\Debug\work2.exe
?????文件?????????180??2018-03-17?14:40??work2\work2\obj\Debug\work2.Form1.resources
?????文件???????26112??2018-03-17?14:57??work2\work2\obj\Debug\work2.pdb
............此處省略10個文件信息
評論
共有 條評論