原資料
Adams,Terry,120
Fakhouri,Fadi,116
Feng,Hanying,117
Garcia,Cesar,114
Garcia,Debra,115
Garcia,Hugo,118
Mortensen,Sven,113
O'Donnell,Claire,112
Omelchenko,Svetlana,111
Tucker,Lance,119
Tucker,Michael,122
Zabokritski,Eugene,121
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string[] lines = System.IO.File.ReadAllLines(@"D:\spreadsheet1.csv");
var result = lines
.Select(line => line.Split(','))
.Select(s => new
{
Col1 = s[2].ToString(),
Col2 = $"{s[1]} {s[0]}"
})
.OrderBy(c => c.Col1);
foreach (var item in result)
{
Console.WriteLine($"{item.Col1} - {item.Col2}" );
}
}
}
}
沒有留言:
張貼留言