Information Technology Reference
In-Depth Information
public
Customer(
string
name)
{
this
.name = name;
}
#region
IComparable<Customer> Members
public int
CompareTo(
Customer
other)
{
return
name.CompareTo(other.name);
}
#endregion
#region
IComparable Members
int
IComparable
.CompareTo(
object
obj)
{
if
(!(obj
is
Customer
))
throw new
ArgumentException
(
"Argument is not a Customer"
,
"obj"
);
Customer
otherCustomer = (
Customer
)obj;
return this
.CompareTo(otherCustomer);
}
#endregion
// Relational Operators.
public static bool operator
<(
Customer
left,
Customer
right)
{
return
left.CompareTo(right) <
0
;
}
public static bool operator
<=(
Customer
left,
Customer
right)
{
return
left.CompareTo(right) <=
0
;
}
public static bool operator
>(
Customer
left,
Customer
right)
{
return
left.CompareTo(right) >
0
;
}