|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Extension Methods in VB 2008 Express?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
Show quote
Hide quote
"dave" <d***@discussions.microsoft.com> schrieb Add a reference to System.Core.dll> 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 Armin
Show quote
Hide quote
> I can't get Extension Methods to work in Visual Basic 2008 Express. Are you targetting .Net 2.0, see my blog posts....> > 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 Where I thought it was a bug.... ------------------------------------------------------------- http://rorybecker.blogspot.com/2007/11/multi-target-net-20-or-extension.html ------------------------------------------------------------- ....and when I realised what was happening... ------------------------------------------------------------- http://rorybecker.blogspot.com/2007/11/solved-multi-target-net-20-or-extension.html ------------------------------------------------------------- Hope this helps -- Rory Alternatively you might not have added a reference to System.Core.dll to
your .Net 3.5 project -- Rory That was it. Thank you.
Show quoteHide quote "Rory Becker" wrote: > Alternatively you might not have added a reference to System.Core.dll to > your .Net 3.5 project > > -- > Rory > > > |
|||||||||||||||||||||||