tags:

views:

123

answers:

3

Hi, stupid question here. I'm trying to create a helper method, something similar to the radio button list in the MVC futures project (as a learning tool).

I'm trying to convert the C# code:

 public static string[] RadioButtonList(this HtmlHelper htmlHelper, string name, IDictionary<string, object> htmlAttributes) {

to a method signature in VB.net, but I'm not sure how to write the first parameter in VB.net, or what you would call this, so I could look it up?

+1  A: 

I'm not either. But this is the signature of an extension method. Here's the MSDN docs on doing this in VB.

Will
Thanks for the link.
Paddy
+1  A: 

I believe this will work as long as you remember to mark it as an extension method, you could look up Extension Methods on MSDN.com. They have examples of how to write extension methods in VB.net.

<System.Runtime.CompilerServices.Extension> _
Public Shared Function RadioButtonList(ByVal htmlHelper As HtmlHelper, ByVal name As String, ByVal htmlAttributes As IDictionary(Of String, Object)) As String()
    
End Function
Brandon
A: 

They are called Extension methods, and are declared in VB.Net like this:

<System.Runtime.CompilerServices.Extension()> _
Public Sub RadioButtonList(ByVal name As String, ...)
// There's no "this" parameter at all...
Tomas Lycken