using System.ComponentModel.DataAnnotations;
public static void Main()
Learner learner = new Learner {
Console.WriteLine(learner.Address);
Type type = typeof(Learner);
PropertyInfo property = type.GetProperty(nameof(Learner.Address));
object[] attributes = property.GetCustomAttributes(true);
Console.WriteLine($"Attributes on property '{property.Name}':");
foreach (object attribute in attributes)
Console.WriteLine(attribute.GetType().Name);
Type[] interfaces = type.GetInterfaces();
Console.WriteLine($"Interfaces implemented by {type.Name}:");
foreach (Type iface in interfaces)
Console.WriteLine(iface.Name);
property = iface.GetProperty(nameof(Learner.Address));
attributes = property.GetCustomAttributes(true);
Console.WriteLine($"Attributes on property '{property.Name}':");
foreach (object attribute in attributes)
Console.WriteLine(attribute.GetType().Name);
public interface YearOne {
public string Address { get; set; }
public interface YearTwo {
public string Address { get; set; }
public class Learner : YearOne, YearTwo {
public string Address { get; set; }