سلام خدمت کاربران وب سایت پروگرم 98 😉 در این پست آموزش خواندن فایل با StreamReader در c#.net را آماده کردم. انشاالله که این کد براتون مفید باشه.
خروجی این کد به صورت زیر می باشد:
asdfasdf
کد خواندن فایل با StreamReader در c#.net :
using System;
using System.IO;
class MainClass {
public static void Main() {
FileStream fin;
string s;
try {
fin = new FileStream("test.txt", FileMode.Open);
}
catch(FileNotFoundException exc) {
Console.WriteLine(exc.Message + "Cannot open file.");
using System.IO;
class MainClass {
public static void Main() {
FileStream fin;
string s;
try {
fin = new FileStream("test.txt", FileMode.Open);
}
catch(FileNotFoundException exc) {
Console.WriteLine(exc.Message + "Cannot open file.");