I'm trying to set a value that's nested within another class. There are a lot of levels, which are starting to confuse me, and I need a second (or third) opinion.
The two named classes at the bottom are third party classes from Ivi.Visa.Interop.dll (a VISA communication library). I do not have access to their source code.
Visually, it looks like this:
Parent (A)
temp = new B();
temp.session = new FormattedIO488();
temp.session.IO = ...
temp.session.IO.TerminationCharacterEnabled = ...
Subclass (B) : Parent (A)
...
public dynamic session
...
FormattedIO488: IFormattedIO488
...
IMessage IO { get; set; }
...
IMessage: IBaseMessage
...
[DispId(1610743814)]
bool TerminationCharacterEnabled { get; set; }
...
The problem: I want to set TerminationCharacterEnabled, but during Runtime, the system can't find the property. It can find FormattedIO488.IO, but it can't find any sub-properties.
I have observed that IO is null after creating a new FormattedIO488, but I can't create a new instance of the abstract class IMessage.
I do not have the issue when I do something like this:
FormattedIO488 temp = new FormattedIO488()
temp.IO = ...
temp.IO.TerminationCharacterEnabled = ...
I've scoured the internet and StackOverflow, trying a bunch of different solutions to get something, but so far I haven't found a solution. Any help or tips would be highly appreciated.
Aucun commentaire:
Enregistrer un commentaire