using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class TestIO
{
static void Main()
{
string line = "first-main-in-c#";
var stringQuery = from ch in line where Char.IsDigit(ch) select new string(ch + '-');
foreach (var c in stringQuery)
Console.Write(c);
Console.WriteLine(System.Environment.NewLine + "Press any key to exit");
Console.ReadKey();
}
}
}
我是 c# 的初学者,我的错误是什么,我期望这个输出:
f-i-r-s-t-m-a-i-n-i-n-c
但我得到:
System.Linq.Enumerable+WhereSelectEnumerableIterator`2[System.Char,<>f__Anonymou
sType0`1[System.Int32]]