Is it possible to overload operators in vb.net?
Is it possible to do programmer defined boxing on byvalue
variables in vb.net? 11 1707
No and no. VB does not support this.
If you need this capability, I recommend you use C#.
"bi********@csa.com" <an*******@discussions.microsoft.com> wrote in message
news:03****************************@phx.gbl... Is it possible to overload operators in vb.net?
Is it possible to do programmer defined boxing on byvalue variables in vb.net?
Bill,
You will need to wait for VB.NET 2004 (Whidbey) to get overloaded operators. http://msdn.microsoft.com/vstudio/pr...o/roadmap.aspx
Hope this helps
Jay
"bi********@csa.com" <an*******@discussions.microsoft.com> wrote in message
news:03****************************@phx.gbl... Is it possible to overload operators in vb.net?
Is it possible to do programmer defined boxing on byvalue variables in vb.net?
In article <e0**************@TK2MSFTNGP12.phx.gbl>, Ja********@email.msn.com says... Bill, You will need to wait for VB.NET 2004 (Whidbey) to get overloaded operators.
Will we then be able to overload the assignment operator in C#?
-- Rick
Rick,
Why would you want to?
With overloading implicit & explicit operators why would you want to
overload the assignment operator?
As for if C# is going to or not going to support overloading the assignment
operator, all I can say is what is in the article I referenced in my earlier
post.
Just a thought
Jay
"Guinness Mann" <GM***@dublin.com> wrote in message
news:MP************************@news.newsguy.com.. . In article <e0**************@TK2MSFTNGP12.phx.gbl>, Ja********@email.msn.com says... Bill, You will need to wait for VB.NET 2004 (Whidbey) to get overloaded
operators. Will we then be able to overload the assignment operator in C#?
-- Rick
In article <u4**************@TK2MSFTNGP10.phx.gbl>, Ja********@email.msn.com says... With overloading implicit & explicit operators why would you want to overload the assignment operator?
You're suggesting that:
MyStruct A = new MyStruct();
<some operations on A>
MyStruct B = new MyStruct(A);
Is better than:
MyStruct A = new MyStruct();
MyStruct B = new MyStruct();
<some operations on A>
B = A;
-- Rick
Rick,
No. My question is not suggesting anything, my question is asking a
question. I restated my first question "Why would you want to overload the
assignment operator?", Maybe I inverted the second question, and I should
have asked "What would you do with an overloaded assignment operator that
you cannot do with implicit & explicit operators?"
Again these are questions, not suggestions. If you answer the questions,
then maybe I or someone else can give you a plausible answer.
I am not seeing, as you did not demonstrate, in your example how overloading
the assignment operator will help, Care to explain what you are thinking,
what you are after in your example.
Remember I am not suggesting anything, I am asking you a question on what
you are wanting in an overloaded assignment operator!
Thanks for understanding.
Jay
"Guinness Mann" <GM***@dublin.com> wrote in message
news:MP************************@news.newsguy.com.. . In article <u4**************@TK2MSFTNGP10.phx.gbl>, Ja********@email.msn.com says... With overloading implicit & explicit operators why would you want to overload the assignment operator?
You're suggesting that:
MyStruct A = new MyStruct(); <some operations on A> MyStruct B = new MyStruct(A);
Is better than:
MyStruct A = new MyStruct(); MyStruct B = new MyStruct(); <some operations on A> B = A;
-- Rick
In article <#G**************@TK2MSFTNGP10.phx.gbl>, Ja********@email.msn.com says... Remember I am not suggesting anything, I am asking you a question on what you are wanting in an overloaded assignment operator!
So that I can do this: MyStruct A = new MyStruct(); MyStruct B = new MyStruct(); <some operations on A> B = A;
In a practical application, there would be operations on B, also. You
want a concrete example? Suppose that A and B represent the tuning
registers on two radios and that occasionally I want to synchronize
them.
-- Rick
Rick, want a concrete example? Suppose that A and B represent the tuning registers on two radios and that occasionally I want to synchronize them.
It would seem that you want to redefine the meaning of what assignment is to
be mean synchronize.
Where assignment means to replace one object with another, and synchronize
means to update part of one object with parts of another object.
Reading your initial example I took it to be assignment, as that is what you
had, now you are telling me you really meant for it to be synchronize.
How is any one other than you, to know that although you are using the
assignment operator you really intend for the synchronize "operation" to be
performed?
Further, if "=" is now synchronize, how do you propose to assign one
MyStruct variable to a different MyStruct variable?
Lastly using the assignment operator to mean synchronize also goes against
the .NET Design Guidelines for Class Library Developers.
<blockquote>
Use operator overloading in cases where it is immediately obvious what the
result of the operation will be. For example it makes sense to be able to
subtract one Time value from another Time value and get a TimeSpan. However,
it is not appropriate to use the or operator to create the union of two
database queries, or to use shift to write to a stream.
</blockquote> http://msdn.microsoft.com/library/de...Guidelines.asp
Notice the "immediately obvious" in that statement.
Personally if I wanted two objects to be synchronized I would have one
object raise events that the other object listened to updating itself
accordingly. Or the class would have a Synchronize or UpdateWith method. MyStruct A = new MyStruct(); MyStruct B = new MyStruct(); <some operations on A> B.Synchronize(A);
Hope this helps
Jay
"Guinness Mann" <GM***@dublin.com> wrote in message
news:MP************************@news.newsguy.com.. . In article <#G**************@TK2MSFTNGP10.phx.gbl>, Ja********@email.msn.com says... Remember I am not suggesting anything, I am asking you a question on
what you are wanting in an overloaded assignment operator!
So that I can do this: MyStruct A = new MyStruct(); MyStruct B = new MyStruct(); <some operations on A> B = A;
In a practical application, there would be operations on B, also. You want a concrete example? Suppose that A and B represent the tuning registers on two radios and that occasionally I want to synchronize them.
-- Rick
Doh! Where assignment means to replace one object with another, and synchronize means to update part of one object with parts of another object.
Technically I should have stated, "replace one variable with another
variable".
Jay
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message
news:Op*************@TK2MSFTNGP11.phx.gbl... Rick, want a concrete example? Suppose that A and B represent the tuning registers on two radios and that occasionally I want to synchronize them. It would seem that you want to redefine the meaning of what assignment is
to be mean synchronize.
Where assignment means to replace one object with another, and synchronize means to update part of one object with parts of another object.
Reading your initial example I took it to be assignment, as that is what
you had, now you are telling me you really meant for it to be synchronize.
How is any one other than you, to know that although you are using the assignment operator you really intend for the synchronize "operation" to
be performed?
Further, if "=" is now synchronize, how do you propose to assign one MyStruct variable to a different MyStruct variable?
Lastly using the assignment operator to mean synchronize also goes against the .NET Design Guidelines for Class Library Developers.
<blockquote> Use operator overloading in cases where it is immediately obvious what the result of the operation will be. For example it makes sense to be able to subtract one Time value from another Time value and get a TimeSpan.
However, it is not appropriate to use the or operator to create the union of two database queries, or to use shift to write to a stream. </blockquote>
http://msdn.microsoft.com/library/de...Guidelines.asp Notice the "immediately obvious" in that statement.
Personally if I wanted two objects to be synchronized I would have one object raise events that the other object listened to updating itself accordingly. Or the class would have a Synchronize or UpdateWith method.
> MyStruct A = new MyStruct(); > MyStruct B = new MyStruct(); > <some operations on A> > B.Synchronize(A); Hope this helps Jay
"Guinness Mann" <GM***@dublin.com> wrote in message news:MP************************@news.newsguy.com.. . In article <#G**************@TK2MSFTNGP10.phx.gbl>, Ja********@email.msn.com says... Remember I am not suggesting anything, I am asking you a question on what you are wanting in an overloaded assignment operator!
So that I can do this:
> MyStruct A = new MyStruct(); > MyStruct B = new MyStruct(); > <some operations on A> > B = A;
In a practical application, there would be operations on B, also. You want a concrete example? Suppose that A and B represent the tuning registers on two radios and that occasionally I want to synchronize them.
-- Rick
In article <Op*************@TK2MSFTNGP11.phx.gbl>, Ja********@email.msn.com says...
Does that mean no?
-- Rick
P.S. Do you have any examples of how to parse Word XP files using XML?
Does Office 2003 have better support for such an operation?
[RF] Rick, want a concrete example? Suppose that A and B represent the tuning registers on two radios and that occasionally I want to synchronize them. It would seem that you want to redefine the meaning of what assignment is to be mean synchronize.
Where assignment means to replace one object with another, and synchronize means to update part of one object with parts of another object.
Reading your initial example I took it to be assignment, as that is what you had, now you are telling me you really meant for it to be synchronize.
How is any one other than you, to know that although you are using the assignment operator you really intend for the synchronize "operation" to be performed?
Further, if "=" is now synchronize, how do you propose to assign one MyStruct variable to a different MyStruct variable?
Lastly using the assignment operator to mean synchronize also goes against the .NET Design Guidelines for Class Library Developers.
<blockquote> Use operator overloading in cases where it is immediately obvious what the result of the operation will be. For example it makes sense to be able to subtract one Time value from another Time value and get a TimeSpan. However, it is not appropriate to use the or operator to create the union of two database queries, or to use shift to write to a stream. </blockquote>
http://msdn.microsoft.com/library/de...Guidelines.asp
Notice the "immediately obvious" in that statement.
Personally if I wanted two objects to be synchronized I would have one object raise events that the other object listened to updating itself accordingly. Or the class would have a Synchronize or UpdateWith method.
> MyStruct A = new MyStruct(); > MyStruct B = new MyStruct(); > <some operations on A> > B.Synchronize(A);
Hope this helps Jay
"Guinness Mann" <GM***@dublin.com> wrote in message news:MP************************@news.newsguy.com.. . In article <#G**************@TK2MSFTNGP10.phx.gbl>,
Rick,
I believe we had earlier established that current versions of C# do not
support overloading the assignment operator. That all I know about future
versions of C# or VB.NET is what is documented in the roadmap. http://msdn.microsoft.com/vstudio/pr...o/roadmap.aspx
That the road map does not confirm nor deny that overloading the assignment
operator will be supported in the next or future versions of either C# or
VB.NET.
Hope this helps
Jay
"Guinness Mann" <GM***@dublin.com> wrote in message
news:MP************************@news.newsguy.com.. . In article <Op*************@TK2MSFTNGP11.phx.gbl>, Ja********@email.msn.com says...
Does that mean no?
-- Rick
P.S. Do you have any examples of how to parse Word XP files using XML? Does Office 2003 have better support for such an operation? [RF]
Rick, want a concrete example? Suppose that A and B represent the tuning registers on two radios and that occasionally I want to synchronize them. It would seem that you want to redefine the meaning of what assignment
is to be mean synchronize.
Where assignment means to replace one object with another, and
synchronize means to update part of one object with parts of another object.
Reading your initial example I took it to be assignment, as that is what
you had, now you are telling me you really meant for it to be synchronize.
How is any one other than you, to know that although you are using the assignment operator you really intend for the synchronize "operation" to
be performed?
Further, if "=" is now synchronize, how do you propose to assign one MyStruct variable to a different MyStruct variable?
Lastly using the assignment operator to mean synchronize also goes
against the .NET Design Guidelines for Class Library Developers.
<blockquote> Use operator overloading in cases where it is immediately obvious what
the result of the operation will be. For example it makes sense to be able
to subtract one Time value from another Time value and get a TimeSpan.
However, it is not appropriate to use the or operator to create the union of two database queries, or to use shift to write to a stream. </blockquote>
http://msdn.microsoft.com/library/de...Guidelines.asp Notice the "immediately obvious" in that statement.
Personally if I wanted two objects to be synchronized I would have one object raise events that the other object listened to updating itself accordingly. Or the class would have a Synchronize or UpdateWith method.
> > MyStruct A = new MyStruct(); > > MyStruct B = new MyStruct(); > > <some operations on A> > > B.Synchronize(A);
Hope this helps Jay
"Guinness Mann" <GM***@dublin.com> wrote in message news:MP************************@news.newsguy.com.. . In article <#G**************@TK2MSFTNGP10.phx.gbl>, This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: David Winter |
last post by:
As a technical author and translator, I am highly interested in single
source/multi format publishing. Meaning: I'd like to keep manuals,
technical specifications etc. in multiple languages...
|
by: Vick |
last post by:
Hi Folks,
I'm not too sure if this is the appropriate place to ask this
question, but I'm trying to figure out what some of the main
differences between the following Job roles are on an IT...
|
by: Junpei |
last post by:
I need recommendations for a scientific app I'm making, here's what i
need, in order of importance
1) Strong/Complete 2d/3d plotting widgets for both data and functions
2) Realtime 2d-plotting
3)...
|
by: shaun.mostashari |
last post by:
Hello all, I am working on a trade study and one of the criterias is
how easy it is to get DB2 technical support from IBM. I appreciate if
you guys share your experience with me. Does DB2 have a...
|
by: Cherrish Vaidiyan |
last post by:
Frinds,
Hope everyone is doing fine.i feel pointers to be the most toughest
part in C. i have just completed learning pointers & arrays related
portions. I need to attend technical interview on...
|
by: Geoff Caplan |
last post by:
Hi folks,
The thread on injection attacks was very instructive, but seemed to
run out of steam at an interesting point. Now you guys have kindly
educated me about the real nature of the issues,...
|
by: flit |
last post by:
Hello All,
I have a hard question, every time I look for this answer its get out
from the technical domain and goes on in the moral/social domain.
First, I live in third world with bad gov., bad...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |