How can I access C# class attributes inside a Razor engine view file?
C# class:
[Name="Test"]
public class OrderProgressPage
{
bool isComplete();
}
Razor view:
@model ViewModels.OrderProgressPage
<ul>
<li>@GETAttribute(Name,Model)</li>
<ul>
One clean way to do that would be by using a local function in the Razor file
Reference: http://msdn.microsoft.com/en-us/library/71s1zwct.aspx
If you need to pass in an attribute name to check, you can use
Depending on what you are doing, you could also change GetTestAttribute to a generic function with a signature like