Columns such as getting the value of the phone property
typeof (Excelcolumnname). GetProperty ("Phone"). GetValue (nullnull)//Excelcolumnname is a static class
The Excelcolumnname class is as follows:
1 /// <summary>2 ///columns that are included in Excel to upload3 /// </summary>4 Public Static classExcelcolumnname5 {6 Public Static stringPhone {Get;Set; } ="mobile Number (required)";7 Public Static stringName {Get;Set; } ="User name (the default is the same as the phone number)";8 Public Static stringRealname {Get;Set; } ="real name";9 Public Static stringCardno {Get;Set; } ="ID Number";Ten Public Static stringReferees {Get;Set; } ="Recommended Person"; One Public Static stringCreatetime {Get;Set; } ="Registration Date (format 2016/1/2)"; A Public Static stringCompanyName {Get;Set; } ="Work Unit"; - Public Static stringEmail {Get;Set; } ="Email"; - the Public Staticlist<string> columnlist =Newlist<string> - { - Phone, - Name, + Realname, - Cardno, + Referees, A Createtime, at CompanyName, - Email - }; -}
Ps: It is important to note that static fields are not available if they are defined as follows: In this case, the phone is not considered to be a property of the class, and it cannot be reached by the reflection property.
Public Static string " mobile Number (required) ";
Use reflection to get static property values for static classes (string representations of known property names)