หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
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