I have the following structure:
abstract class Parent {}
class Child : Parent
{
// Member Variable that I want access to:
OleDbCommand[] _commandCollection;
// Auto-generated code here
}
Is it possible to use reflection from within the Parent class to access the _commandCollection within the Child class? If not any suggestions on how I can achieve this?
EDIT:
Its probably worth mentioning that in the abstract Parent class I plan to use IDbCommand[] to handle the _commandCollection object as not all my TableAdapters will be using OleDb to connect to their respective databases.
EDIT2:
For all the comments saying … just add a property of function to the child class, I can’t as its automatically generated by the VS Designer. I really don’t want to have to re-do my work every time I change something in the designer!
Array covariance should ensure that the cast is successful.
I assume some designer will be generating the subclasses? Otherwise, a protected property is probably what you’re looking for.