当前位置导航:炫浪网>>网络学院>>编程开发>>Visual C#教程

C#中Command类的使用

         using System;
        using System.IO;
        namespace StreamReadWrite
        {
            /// <summary>
            /// StreamReaderClass 的摘要说明。
            /// </summary>
            class StreamReaderWriteClass
            {
                /// <summary>
                /// 应用程序的主入口点。
                /// </summary>
                [STAThread]
                static void Main(string[] args)
                {
                    StreamWriter streamWriter = new StreamWriter("Test.txt", false, System.Text.Encoding.Default);
                    string str = "0094C5E4,77,1,2006-07-04,2006-07-04,1时13分,0,1";
                    streamWriter.WriteLine(str);
                    streamWriter.Close();
                    string[] Data;
                    StreamReader streamReader = new StreamReader("Test.txt", System.Text.Encoding.Default);
                    str = streamReader.ReadLine();
                    Data = str.Split(',');
                    Console.WriteLine("读出的数据");
                    Console.WriteLine("{0}\n{1}\n{2}\n{3}\n{4}\n{5}\n{6}",
                        Data[0], Data[1], Data[2], Data[3], Data[4], Data[5], Data[6]);
                    streamReader.Close();
                    Console.ReadLine();
                }
            }
        }

相关内容
赞助商链接