Access Custom Attribute from within an Editor Template

Viewed 662

Is it possible to access a custom attribute on a property from within an editor template for that property?

For example, I have a simple class with a custom property:

public class MyClass
{
   [MyCustomAttribute("myCustomValue")]
   public string Name { get; set; }
}

I then have an editor template for string and I would like to check that the string property has that custom attribute.

I've tried accessing the type and CustomAttributes from the view, but that won't work when the instance of the model is null.

1 Answers
Related