Skip to main content
 首页 » 编程设计

c#之如何获取类的PropertyName

2024年02月24日27jyk

<分区>

如何获取类的PropertyName?

例如,如何获取 Student 类实例的 PropertyName“StudentName”。

public class Student 
{ 
    public string StudentName{get;set;} 
} 
 
 
Student student = new Student(); 
 
//I want to get the PropertyName "StudentName" 
student.StudentName.GetName();