Extension Methods in VB 2008 Express?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I can't get Extension Methods to work in Visual Basic 2008 Express.

Says "Type 'Extension' is not defined."

Looks like the library included with the Express edition is crippled.

What am I missing?

Here's the code...
Imports System.Runtime.CompilerServices
Module ExtensionMethods
<Extension()> Public Function Test(ByVal str As String) As String
Return str
End Function
End Module
 
dave said:
I can't get Extension Methods to work in Visual Basic 2008 Express.

Says "Type 'Extension' is not defined."

Looks like the library included with the Express edition is
crippled.

What am I missing?

Here's the code...
Imports System.Runtime.CompilerServices
Module ExtensionMethods
<Extension()> Public Function Test(ByVal str As String) As String
Return str
End Function
End Module

Add a reference to System.Core.dll


Armin
 
I can't get Extension Methods to work in Visual Basic 2008 Express.
Says "Type 'Extension' is not defined."

Looks like the library included with the Express edition is crippled.

What am I missing?

Here's the code...
Imports System.Runtime.CompilerServices
Module ExtensionMethods
<Extension()> Public Function Test(ByVal str As String) As String
Return str
End Function
End Module

Are you targetting .Net 2.0, see my blog posts....
Where I thought it was a bug....
 
Alternatively you might not have added a reference to System.Core.dll to
your .Net 3.5 project
 
Back
Top