擴充方法 (VB.NET)

擴充方法 (VB.NET)

Imports System.Runtime.CompilerServices

Module Module2
    Sub main()
        Dim s As String = "hello"
        s.print()
    End Sub
    <Extension()> Public Sub print(ByVal aStrig As String)
        Console.WriteLine(aStrig)
    End Sub
End Module
 


如有錯誤 歡迎指正