How to overload greater than operator

  • Thread starter Thread starter John Mark Howell
  • Start date Start date
J

John Mark Howell

BlankDoes anyone know how to overload the greater than (>) operator? I know that it is probably not in accordance to the framework design patterns, but it would make my code much cleaner.
 
BlankPut this in the class of the type for which you are implementing the
greater than operator.

public static bool operator >(Type1 arg1, Type2 arg2)
{
return blah blah;
}

--
John Wood
EMail: first name, dot, last name, at priorganize.com
Does anyone know how to overload the greater than (>) operator? I know that
it is probably not in accordance to the framework design patterns, but it
would make my code much cleaner.
 
With one clarification.
public static bool operator >(Type1 arg1, Type2 arg2)
{
return blah blah;
}

has to be member of Type1 or Type2
 

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

Back
Top