[英]How can i get the name of property and value from object and pass this name and value to a list in c#
[英]in C#, how can i get the string name from an object
我有一个带有完整名称空间的类似对象。
MyDomainModel.Model.Application
我想在通用函数中执行类似的操作,以使其仅显示“ Application”(没有其余的namepace
我需要在传递通用的函数中执行此操作,因此我尝试执行以下操作:
typeof(T).ToString()
但这没用。 有什么想法吗?
typeof(T).Name
是您要寻找的。
typeof
运算符返回Type
对象,该对象提供有关该类型的大量信息 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.