• Saves Valuable Time
  • Trusted Accuracy for 14 Years
  • 15-Day Money-Back Guarantee

VB Equivalent to C# Extension Methods

VB extension methods use the 'Extension' attribute, while C# extension methods use the 'this' keyword on the first parameter.

C# VB
public static class Foo
{
    public static void Extension(this string myParam)
    {
        //...
    }
}
Public Module Foo
    <System.Runtime.CompilerServices.Extension> _
    Public Sub Extension(ByVal myParam As String)
        '...
    End Sub
End Module


Use Instant VB to convert from C# to VB.NET.     

Additional resource: VB.NET and C# Equivalents


Copyright © 1997 – 2018 Tangible Software Solutions, Inc.