I have a student class with the following structure:
public sealed class Student
{
public string Name {get;set;}
public string RollNo {get;set;}
public string standard {get;set;}
public bool IsScholarshipped {get;set;}
public List<string> MobNumber {get;set;}
}
How can I get those properties of
Student
class in an array like
arr[0]=Name;
arr[1]=RollNo;
.
.
.
arr[4]=MobNumber
And the types of these properties in separate array like
arr2[0]=string;
arr2[1]=string;
.
.
.
arr2[4]=List<string> or IEnumerable
Please , explain it with chunk of code.
That will give you an array of
PropertyInfo. You can then do this to get just the names: