G
Guest
Hello everybody,
I have a problem towards the following topic.
There is a class like MyColor and a class like MyRectangle that has a
property called FillColor which is of type MyColor. Now it should be able to
say
MyRectangle rect1 = new MyRectangle();
rect1.FillColor = "Red";
Therefore I need an implicit cast operator but this causes the loss of
further information that are hold in the MyColor object stored in
rect1.FillColor before. So I need to transfer further data than just a string
during conversion from the old object to the new object. Lets say the old
FillColor had a property called Remark with a value "Test-Remark". This
property would be empty after static implicit type conversion.
Is it possible to use the TypeConverter.CreateInstance method therefore? And
if yes, how exactly?
Users or other developers should be allowed to write rect1.FillColor =
"green" without calling the TypeConverter explicitly.
Thanks if anyone has help for me.
Matthias
Germany/Austria
I have a problem towards the following topic.
There is a class like MyColor and a class like MyRectangle that has a
property called FillColor which is of type MyColor. Now it should be able to
say
MyRectangle rect1 = new MyRectangle();
rect1.FillColor = "Red";
Therefore I need an implicit cast operator but this causes the loss of
further information that are hold in the MyColor object stored in
rect1.FillColor before. So I need to transfer further data than just a string
during conversion from the old object to the new object. Lets say the old
FillColor had a property called Remark with a value "Test-Remark". This
property would be empty after static implicit type conversion.
Is it possible to use the TypeConverter.CreateInstance method therefore? And
if yes, how exactly?
Users or other developers should be allowed to write rect1.FillColor =
"green" without calling the TypeConverter explicitly.
Thanks if anyone has help for me.
Matthias
Germany/Austria