Extension methods can be defined only in modules
This error occurs when an extension method has been defined outside a module. In Visual Basic, all extension methods must be defined within standard modules.
Error ID: BC36551
To correct this error
- Place the extension method in a module.
Example
The following example extends the String
class, adding a Print
method.
Imports StringUtility
Imports System.Runtime.CompilerServices
Namespace StringUtility
<Extension()> _
Module StringExtensions
<Extension()> _
Public Sub Print (ByVal str As String)
Console.WriteLine(str)
End Sub
End Module
End Namespace
See also
Sarađujte sa nama na GitHub-u
Izvor za ovaj sadržaj možete da pronađete u usluzi GitHub, gde možete i da kreirate i pregledate probleme i povučete zahteve. Više informacija potražite u našem vodiču za saradnike.
Povratne informacije
https://aka.ms/ContentUserFeedback.
Stiže uskoro: Tokom 2024. godine postepeno ćemo ukidati probleme sa uslugom GitHub kao mehanizam povratnih informacija za sadržaj i zameniti ga novim sistemom povratnih informacija. Dodatne informacije potražite u članku:Prosledite i prikažite povratne informacije za