Text 읽기(주석가능 //)

|

/* 주석 문자로는 // 사용 */

 

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

 

namespace CommandTest
{
    class Program
    {
        static void Main(string[] args)
        {
            FileStream fs = new FileStream("test.txt", FileMode.OpenOrCreate);
            StreamReader reader = new StreamReader(fs, Encoding.Default);
            fs.Seek(0, SeekOrigin.Begin);
            while (!reader.EndOfStream)
            {
                string tmp = reader.ReadLine();//문자설정
                string[] split = tmp.Split(new string[] { "//" }, StringSplitOptions.None);
                string Data = null;
                if (split.Length == 1)
                {
                    Data = split[0];
                }
                else if (split.Length > 1)
                {
                    if (split[0].Length > 0)
                        Data = split[0];
                }
                if (Data != null)
                {
                    Console.WriteLine(Data);
                }
            }//여기까지 알고 .. 알아서 알아보시길..
            reader.Close();
            fs.Close();
        }
    }
}

And