G
Guest
I am writing a simulation program, the main classes inherit from a base class
which itself inherits from Control. I am using reflection to serialize these
objects including the fields from control. This works perfectly apart from
the field text in Control which always comes back null. Although the IDE
always shows it having the correct value. Since the IDE presumably uses
reflection to show the value, I am at a loss to know why this one field is a
problem. Interestingly, the command window also comes back with a null, when
doing the same operation, but if you do the operation on the original object
just after creation it is correct. It is worth noting the objects are placed
in a Collection before serialization. So it is using FieldInfo.GetValue on
the items in the Collection which is failing on the string field.
which itself inherits from Control. I am using reflection to serialize these
objects including the fields from control. This works perfectly apart from
the field text in Control which always comes back null. Although the IDE
always shows it having the correct value. Since the IDE presumably uses
reflection to show the value, I am at a loss to know why this one field is a
problem. Interestingly, the command window also comes back with a null, when
doing the same operation, but if you do the operation on the original object
just after creation it is correct. It is worth noting the objects are placed
in a Collection before serialization. So it is using FieldInfo.GetValue on
the items in the Collection which is failing on the string field.