How do I get any object and its private field read and then returned
public class Person { private string _password;
public Person(string name, Gender sex, int age, string pwd)
{
Name = name;
Sex = sex;
Age = age;
_password = pwd;
}
public string Name { get; }
public Gender Sex { get; }
public int Age { get; }
}
public static string ReadPrivateField(object obj, string fieldName) {
}
Aucun commentaire:
Enregistrer un commentaire