@using System.Reflection
@using System.ComponentModel.DataAnnotations
@using Shared.DTOs
@typeparam T
@{
PropertyInfo[] properties = typeof(T).GetProperties();
foreach (var item in properties)
{
if (item.GetCustomAttributes(typeof(DisplayAttribute), false).Length > 0)
{
@item.CustomAttributes.Where(w => w.AttributeType.Name == "DisplayAttribute").Select(s => s.NamedArguments.Where(w => w.MemberName == "Name").Select(ss => ss.TypedValue.Value).First()).First().ToString()
|
}
}
}
@{
foreach (var item in ModelinComponent)
{
@{
properties = item.GetType().GetProperties();
foreach (PropertyInfo property in properties)
{
if (property.CustomAttributes.Any(w => w.AttributeType.Name == "DisplayAttribute"))
{
@property.GetValue(item, null) |
}
}
}
}
}
@code {
[Parameter]
public List ModelinComponent { get; set; } = new List();
}