我想要做的是让用户输入一串由空格分隔的数字序列。保存这些数字后,我想返回一个字符串,其中每个数字只出现一次,即使该数字在序列中出现了n次。
string[] tempNumbers = textValue.Split(' ');
IEnumerable<string> distinctNumbers = tempNumbers.Where(value => value.Distinct());
我遇到了这个错误:
Error 2 Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<char>' to 'bool' c:\users\sergio\documents\visual studio 2010\Projects\LinqPlayground\LinqPlayground\SetSemanticsExample.cs 67 75 LinqPlayground