I have a class and properties. An attribute may be marked on some properties (it inherits my LocalizedDisplayName from DisplayNameAttribute ). This is the method to get all the properties of a class:
private void FillAttribute() { Type type = typeof (NormDoc); PropertyInfo[] propertyInfos = type.GetProperties(); foreach (var propertyInfo in propertyInfos) { ... } }
I want to add class properties to the list marked LocalizedDisplayName and display the attribute value in the list. How can i do this?
EDIT
This is LocalizedDisplayNameAttribute:
public class LocalizedDisplayNameAttribute : DisplayNameAttribute { public LocalizedDisplayNameAttribute(string resourceId) : base(GetMessageFromResource(resourceId)) { } private static string GetMessageFromResource(string resourceId) { var test =Thread.CurrentThread.CurrentCulture; ResourceManager manager = new ResourceManager("EArchive.Data.Resources.DataResource", Assembly.GetExecutingAssembly()); return manager.GetString(resourceId); } }
I want to get a string from a resource file. Thank.
reflection c #
user348173 Sep 05 2018-11-11T00: 00Z
source share