I’ve been reading up on MVC and understanding it’s framework. Of course everything out there is in C#, which is fine, however I prefer to write in VB.Net. This causes some of the examples of lambda expressions and other things to alter, and can be a pain if you are unsure has how.
This post is specific to the HtmlHelper, and extending it on MVC.
In mvc, you have access to an html. namespace, for links and other html controls.
This post will just show you the difference from the c# examples.
And then in VB.Net
You’ll notice that in the C# version it uses a “Static” keyword on the Class. In VB that equivalent keyword is “Shared”. However, in VB you can’t use the “Shared” keyword on a Class. VB only supports “Shared” on Methods. So you should use a Module instead of a Class which is the same thing actually. It’s from the old VB days.
For your function you have to add the attribute
Notice I don’t have the underscore _ line extending, because I’m in VB.Net 10. Previous versions or .Net 3.5 and earlier you’ll need an underscore to connect those two lines.
Other then that it’s about the same. Still have to add it to the web.config the same.
So just remember, use a module instead of class, and add your attribute.