[英]Getting class property name in C#
I want to write common function which get all or single class property name 我想编写获取所有或单个类属性名称的通用函数
public class MyClass
{
public int TemplateId { get; set; }
public int TemplateCategoryId { get; set; }
}
Example: In other method I need to call 示例:在其他方法中,我需要调用
var propertyName = MyClass.TemplateId.GetPrertyName(); // will Return TemplateId
How can I make it? 我该怎么做?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.