This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.VisualBasic.FileIO; | |
namespace cs_read_csv | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
TextFieldParser parser = new TextFieldParser(@"C:\mdb\zzz.txt", Encoding.GetEncoding("Shift_JIS")); | |
parser.TextFieldType = FieldType.Delimited; | |
parser.SetDelimiters(","); // 区切り文字はコンマ | |
while (!parser.EndOfData) | |
{ | |
string[] row = parser.ReadFields(); // 1行読み込み | |
Console.WriteLine(row[0] + "," + row[1] + "," + row[2]); | |
} | |
Console.ReadLine(); | |
} | |
} | |
} | |
0 件のコメント:
コメントを投稿