Muistiinpano
Tälle sivulle pääsy edellyttää valtuutusta. Voit yrittää kirjautua sisään tai vaihtaa hakemistoja.
Tälle sivulle pääsy edellyttää valtuutusta. Voit yrittää vaihtaa hakemistoja.
The only way to extend a data type in Visual Basic is to define an extension method inside a standard module. The extension method can be a Sub procedure or a Function procedure. All extension methods must be marked with the extension attribute, <Extension()>, from the System.Runtime.CompilerServices namespace. Optionally, a module that contains an extension method may be marked in the same way. No other use of the extension attribute is valid.
Error ID: BC36550
To correct this error
Remove the extension attribute.
Redesign your extension as a method, defined in an enclosing module.
Example
The following example defines a Print method for the String data type.
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