2010 Collection class syntax/property problem


  • I converted a project from 2008 to 2010 to be able to use the TPL.

    I've updated the compile target to .NET 4. Everything seems good, including the .NET 4 specific TPL stuff...except that:

    Parallel.ForEach(MyClassCollection.Cast(Of MyClass), (Sub(ANYTHING As MYClass) ANYTHING.MySubRoutine()))

    Gives the following as a syntax error:

    Error 2 'Cast' is not a member of 'Microsoft.VisualBasic.Collection'. C:\Users\jeff\Documents\Visual Studio 2010\Projects\MyProject\MyProject\RunLoop.vb 229 34 MyProject

    Any ideas?

    Wednesday, September 29, 2010 2:20 AM


  • Not sure what TPL is, but if that Cast is an extension method, you have to use the correct Imports (or "using" in C#) statement for it to appear- just including the reference in your project isn't enough.
    Wednesday, September 29, 2010 5:06 PM