
Originally Posted by
Mr. Tomaszek
What I'm trying to acheive is that when type of that property will change I would not have to change the code that is used for setting them.
Ok, I think I understand now.
Can you make use of the using keyword in this case?
Code:
using MyGeneralType = MySpecificType;
class MySpecificType
{
}
class MyOtherType
{
}
//...
class Xyz
{
public MyGeneralType TheProperty { /* ... */ }
void f(object o)
{
this.TheProperty = (MyGeneralType)o;
}
}
That way you can change what type MyGeneralType actually is by modifying just one line:
Code:
using MyGeneralType = MyOtherType;