开发者

Error message: 'OfType' is not a member of 'System.Text

开发者 https://www.devze.com 2023-01-14 02:18 出处:网络
Well the full error is Error 3 \'OfType\' is not a member of \'System.Text.RegularExpressions.MatchCollection\'

Well the full error is

Error 3 'OfType' is not a member of 'System.Text.RegularExpressions.MatchCollection'

in the following lines of code, (curly braces in regex.Matches(input).OfType)

For Each group As Object In regex.Matches(input).OfType(Of Match)().Select(Function(c) c.Value.ToLowerInvariant()).Where(Function(c) Not keywords.Contains(c)).GroupBy(Function(c) c).OrderByDescending(Function(c) c.Count()).ThenBy(Function(c) c.Key)
  Console.WriteLine(group.Key)
Next

What i do no开发者_C百科t get is why this one is working properly on VS2008 but does not in VS2010.


Sure you're referencing or Imports System.Linq in the code under VS2010?


OfType is an extension method in System.Linq.Enumerable, defined in the System.Core assembly. (System.Core.dll)

You'll need a reference to the System.Core assembly and you'll need to import (Imports in VB and using in C#) the System.Linq namespace.


you need to import System.Linq

imports System.Linq
0

精彩评论

暂无评论...
验证码 换一张
取 消