Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do HtmlHelpers need an argument to this HtmlHelper helper?

Tags:

asp.net-mvc

Why do HtmlHelpers need to be declared with an argument to an HtmlHelper helper?

i.e

public static string ScheduleEntries(this HtmlHelper helper, ...)

I've never noticed that syntax before in C#, what is it called?

Thanks

-Matt

like image 509
Matt Frear Avatar asked Jan 24 '23 19:01

Matt Frear


1 Answers

That's an extension method.

The way it works for MVC is that Html in the view is a property of HtmlHelper type on the ViewPage class.

like image 174
John Sheehan Avatar answered Feb 19 '23 07:02

John Sheehan