Is it possible to get or set private fields?
I want to get System.Guid.c. Is there a way to access it or should I just copy the code from the strut and make the fields public?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use reflection as suggested by Quantic Programming
Although if you are okay with first converting the guid to a byte array, I might suggest:
The latter approach avoids using reflection.
Edit
You mention needing to be able to set the value as well, you can still avoid reflection: