does not contain a definition for ‘Distinct’
用这段代码:
using System.Collections.Generic; //.. . . . . code List<string> Words = new List<string>(); // many strings added here . . . Words = Words.Distinct().ToList();
using System.Linq;
?
Distinct是在System.Linq.Enumerable中定义的扩展方法,因此您需要添加该using语句.
并且不要忘记添加对System.Core.dll的引用(如果您使用的是VS2008,这已经为您完成了).