Implicit overloads, non static
- From: "Chad Z. Hower aka Kudzu" <cpub@xxxxxxxxx>
- Date: Thu, 5 May 2005 13:40:22 +0300
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/
"Programming is an art form that fights back"
Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/
.
- Follow-Ups:
- Re: Implicit overloads, non static
- From: Jon Skeet [C# MVP]
- Re: Implicit overloads, non static
- From: Bruce Wood
- Re: Implicit overloads, non static
- Prev by Date: Re: Desperately trying to stop excution
- Next by Date: RE: question about datagrid(WinForm)
- Previous by thread: managed directx suggestions?
- Next by thread: Re: Implicit overloads, non static
- Index(es):