-
March 8th, 2013, 08:16 AM
#1
"operator" like in C++?
Hi! I need to rewrite this from C++ to C#
Code:
FORCEINLINE bool operator == (const edge2f &other) const
{
return (_vids[0] == other._vids[0] && _vids[1] == other._vids[1]);
}
FORCEINLINE - I can ignore this, but is there some representation of "operator" in C#?
As I understand, this part of code hooks up somewhere into if...else comparison, and does extra check as defined, if comparison operator == is used. Is there some equivavent of this in C#?
Or in C#, I need to define custom function like
bool ExtraCheck(const edge2f &other)
{
return (_vids[0] == other._vids[0] && _vids[1] == other._vids[1]);
}
and use it like this all the time?
if (ExtraCheck(edge,_vids));
I hope I can write some clean solution as we can in C++;
It can also be operator +, += and e.t.c
-
March 8th, 2013, 10:42 AM
#2
Re: "operator" like in C++?
Please ignore this question, I've got answer already in other topic, it is called "operator overloading";
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|