Maybe I'd have to expose my problem more clearly from the beginning:
I have a series of classes that I want to display properties via a gridview
Code:
class A
{
int _intA;
public int IntA {get {return _intA;}}
bool _boolA;
public bool BoolA {get {return _boolA;}}
}
class B
{
float _floatB;
public float FloatB {get {return _floatB;}}
string _stringA;
public StringA{get {return _stringA;}}
}
...
For these classes, I would like to add properties
Code:
public string Property1{get ...}
public string Property2{get ...}
for the final classes
Code:
class A_evolved
{
int _intA;
public int IntA {get {return _intA;}}
bool _boolA;
public bool BoolA {get {return _boolA;}}
public string Property1{get ...}
public string Property2{get ...}
}
class B_evolved
{
float _floatB;
public float FloatB {get {return _floatB;}}
string _stringA;
public StringA{get {return _stringA;}}
public string Property1{get ...}
public string Property2{get ...}
}
...
As multiple inheritance does not exist. Either I define an interface and advanced I inherit my advanced classes that interface
Code:
public interface IEvolved
{
string Property1{get ...}
string Property2{get ...}
}
class A_evolved: A, IEvolved
{
string _property1;
public string Property1{get {return _property1;}}
string _property2;
public string Property2{get {return _property2;}}
}
...
But I must do it for each class (unthinkable). Let (fallback) it encapsulates my base class in a class template
Code:
class Evoluee<T>
{
public Evolved(T source) : {object = sources;}
T _object;
string _property1;
public string Property1{get {return _property1;}}
string _property2;
public string Property2{get {return _property2;}}
}
using A_evoluee = Evolved<A>;
using B_evoluee = Evolved<B>;
But in this case the properties of my base class (my _objects) are more accessible and will not appear automatically ...
Any ideas?
Bookmarks