![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Getting reference to left argument of assignment operator Anyone know of any way to get a reference to the argument to the left (lvalue I believe it is called) of the assignment operator? I realize you can't overload the assignment operator in C#, but maybe someone might know some creative solution using unsafe or interoperable C++ code. |
My System Specs![]() |
| | #2 (permalink) |
| | RE: Getting reference to left argument of assignment operator Just make a void method that acts upon the result object. So in code, the following: x = Foobar(2, 3, 4); Becomes: x.Foobar(2, 3, 4); Then Foobar can reference 'this' or 'me' depending on your language. "Mike" wrote: Quote: > Anyone know of any way to get a reference to the argument to the left (lvalue > I believe it is called) of the assignment operator? I realize you can't > overload the assignment operator in C#, but maybe someone might know some > creative solution using unsafe or interoperable C++ code. |
My System Specs![]() |
| | #3 (permalink) |
| | RE: Getting reference to left argument of assignment operator Thanks for the response, but this is not quite what I'm looking for. I'm trying to do an implicit cast from one of the built in .Net types to one of my custom types, but I don't want to have to re-instantiate my custom type when I do the cast. I want a reference to the object I'm assigning to. For example: static public implicit operator RomanNumeral(int value) { return new RomanNumeral(value); } Rather than new up a RomanNumeral object, I want a reference to the RomanNumeral I'm assigning to. I'm sure there's no "normal" way to do this. I'm looking to be atypical. Thanks, Mike "Family Tree Mike" wrote: Quote: > Just make a void method that acts upon the result object. > > So in code, the following: > > x = Foobar(2, 3, 4); > > Becomes: > > x.Foobar(2, 3, 4); > > Then Foobar can reference 'this' or 'me' depending on your language. > > "Mike" wrote: > Quote: > > Anyone know of any way to get a reference to the argument to the left (lvalue > > I believe it is called) of the assignment operator? I realize you can't > > overload the assignment operator in C#, but maybe someone might know some > > creative solution using unsafe or interoperable C++ code. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Variable assignment and clone or objet reference | PowerShell | |||
| Assignment Help | PowerShell | |||
| left side assignment of dual screen desktop | Vista General | |||
| Using a variable on the left-side of an assignment | PowerShell | |||