Visual Basic Implements Error

The other day a coworker was getting a strange error in Visual Studio:

Statement is not valid inside a method/multiline lambda.

 The code causing the problem looked this this:

Public Function GetSupplyList() As IEnumerable(Of SupplyItemDto)
                                    Implements IReadData.GetSupplyList


It took us a minute to realize that in Visual Basic.NET the Implements on a function has to be on the same line as the function. You can also use a line continuation character ("_") to fix the issue.


Of course, this is the exact opposite of  Implements on a class where the Implements keyword has to be on the next line or you'll get "End of statement expected".


Comments

Popular posts from this blog

Restoring Color Icons in Gimp 2.10

PowerBuilder and SQL Server: Tips On Working Together

A tip on multithreading in PowerBuilder