How do know if a class use operator overload?

B

Bengan

Hi!

Where can you see if a class has overloaded operator(like +,-) in Microsofts
NET class library on the net? They list members, properties, fields and
other stuff for a class but no operatoroverloading.

It would be nice to know if a class uses overloaded opetors so you know if
its the default behavior or not when using these operators.

Regards
Bengan
 
J

Jon Skeet [C# MVP]

Where can you see if a class has overloaded operator(like +,-) in Microsofts
NET class library on the net? They list members, properties, fields and
other stuff for a class but no operatoroverloading.

It would be nice to know if a class uses overloaded opetors so you know if
its the default behavior or not when using these operators.

Operators *are* documented, as opGreaterThan, opInequality etc
methods. See DateTime for an example.

Jon
 
A

Alex Meleta

E.g. http://www.c-sharpcorner.com/Upload...ding11142005003229AM/OperatorOverloading.aspx

WBR, Alex Meleta
Blog:: devkids.blogspot.com



B> Hi!
B>
B> Where can you see if a class has overloaded operator(like +,-) in
B> Microsofts NET class library on the net? They list members,
B> properties, fields and other stuff for a class but no
B> operatoroverloading.
B>
B> It would be nice to know if a class uses overloaded opetors so you
B> know if its the default behavior or not when using these operators.
B>
B> Regards
B> Bengan
 
C

Christof Nordiek

Jon Skeet said:
Operators *are* documented, as opGreaterThan, opInequality etc
methods. See DateTime for an example.
But they don't list operators predefined by C# (like int + int). For this
you have to look in the C# reference or specification.

Christof
 
J

Jon Skeet [C# MVP]

But they don't list operators predefined by C# (like int + int). For this
you have to look in the C# reference or specification.

Indeed. For *most* of the operators, this is probably expected. The
one which is most likely to catch people out (IMO) is string
concatenation, which is a C# operator but not a .NET operator. (The C#
compiler can call String.Concat to concatenate multiple strings in one
go, for instance, which couldn't be done by a normal + operator.)

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top