Reflection, get DataAnnotation attributes from buddy class.
- by Feryt
Hi.
I need to check if property has specific attribute defined in its buddy class:
[MetadataType(typeof(Metadata))]
public sealed partial class Address
{
private sealed class Metadata
{
[Required]
public string Address1 { get; set; }
[Required]
public string Zip { get; set; }
}
}
How to check what properties has defined Required attribute?
Thank you.