【 解 説 】
テキストファイルを読み込むにはStreamReaderを使用します。
【 例 文 】
1 2 3 4 5 6 7 8 9 10 11 12 13 |
// You have to catch exceptions in caller public string Load(string fileName) { string text = ""; StreamReader reader = new StreamReader(fileName, System.Text.Encoding.Default); text = reader.ReadToEnd(); reader.Close(); return text; } |
■お薦め参考関連資料
Microsoft、Visual Studio、Visual Basic、Visual C#、Windows Vista、Windows Server、SQL Server、Visual C++、Visual Web Developerは、米国 Microsoft Corporationの米国及びその他の国における登録商標または商標です。