I have defined some implicit convertors so that I can do:
MyStruct x = 4;
The implicit convert the 4 into MyStruct. But its essentially a copy
constructor and thus if I had:
MyStruct x;
x.SomethingElse = 5;
x = 4;
Now x.SomethingElse will be 0, because x is a new instance. Ok - all proper
and as exected - no questions here.
What I would *like* to do is this. Have the 5 update the object = not replace
it. I shudder to compare this to VB's old "default properties" but
essentially soemething like that.
This is really a non static overload, and as I understand it, C# does not
support this correct? And also there is no way to access the current instance
in the implicit convertors?
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"
Empower ASP.NET with IntraWeb
MyStruct x = 4;
The implicit convert the 4 into MyStruct. But its essentially a copy
constructor and thus if I had:
MyStruct x;
x.SomethingElse = 5;
x = 4;
Now x.SomethingElse will be 0, because x is a new instance. Ok - all proper
and as exected - no questions here.
What I would *like* to do is this. Have the 5 update the object = not replace
it. I shudder to compare this to VB's old "default properties" but
essentially soemething like that.
This is really a non static overload, and as I understand it, C# does not
support this correct? And also there is no way to access the current instance
in the implicit convertors?
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"
Empower ASP.NET with IntraWeb
Comment