DisplayNameHelper kifejlesztése

This commit is contained in:
2025-04-04 13:38:07 +02:00
parent 5b1f7fb642
commit 476c9ead4c
5 changed files with 93 additions and 39 deletions
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.Helper
{
public static class DisplayNameHelper
{
public static string GetDisplayName(string propertyName, Type modelType)
{
var property = modelType.GetProperty(propertyName);
var displayNameAttribute = property?.GetCustomAttributes(typeof(DisplayNameAttribute), false)
.FirstOrDefault() as DisplayNameAttribute;
return displayNameAttribute?.DisplayName ?? propertyName;
}
}
}