开发者

Get attribute and value from generic class

开发者 https://www.devze.com 2023-02-11 03:02 出处:网络
How do I get attribute name and it\'s value using IReadOnlyMappingManager ? I create variable with : mappingManager = ServiceLocator.Current.GetInstance<IReadOnlyMappingManager>();

How do I get attribute name and it's value using IReadOnlyMappingManager ?

I create variable with :

mappingManager = ServiceLocator.Current.GetInstance<IReadOnlyMappingManager>();

An i use

mappingManager.GetFields(typeof(T))
开发者_如何学Python

But I haven't keys and value for fiels.

Thanks


It's a little unclear, but maybe something like this is what you want?

var props = typeof(IReadOnlyMappingManager).GetProperties();
foreach (var p in props)
    var value = p.GetValue(mappingManager)
0

精彩评论

暂无评论...
验证码 换一张
取 消