So my problem is this: I have an object instance represented only by FieldInfo. I have no other access to that object. Is it possible to get that object instance only through the field info like so?
MyObject myObject = fieldInfo.SomeMethodOrProperty as MyObject;
This is just only an illustration, but I think you get the picture.
No, the FieldInfo represents attributes and metadata of a field in regards to a type. It is not attached to a specific instance. When you want to use it, you have to pass in the instance you want it to use (through GetValue or SetValue)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With