How to get a property value using reflection

c#, reflection

Solution

Something like this should work:

var value = (string)GetType().GetProperty("SomeProperty").GetValue(this, null);

Problem

I have the following code: ``` FieldInfo[] fieldInfos; fieldInfos = GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance); ``` What I am trying to do is get the value of one of my properties of the current instantiated instance at runtime using reflection. How can I do this?

Original source

Related problems