views:

44

answers:

3

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 not get is why this one is working properly on VS2008 but does not in VS2010.

+3  A: 

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

p.campbell
+1  A: 

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.

Venemo
A: 

you need to import System.Linq

imports System.Linq
TheVillageIdiot