Great Tool, I wub U
Found An incorrect translation.
C#
public class PropertyOrderPair : IComparable
{
private int _order;
private string _name;
public string Name
{
get
{
return _name;
}
}
public PropertyOrderPair(string name, int order)
{
_order = order;
_name = name;
}
public int CompareTo(object obj)
{
//
// Sort the pair objects by ordering by order value
// Equal values get the same rank
//
int otherOrder = ((PropertyOrderPair)obj)._order;
if (otherOrder == _order)
{
//
// If order not specified, sort by name
//
string otherName = ((PropertyOrderPair)obj)._name;
return string.Compare(_name,otherName);
}
else if (otherOrder > _order)
{
return -1;
}
return 1;
}
}
VB translation:
-
-
- Public Class PropertyOrderPair
-
- Implements IComparable
- Private _order As Integer
- Private _name As String
- Public ReadOnly Property Name() As String
- Get
- Return _name
- End Get
- End Property
-
- Public Sub New(ByVal name As String, ByVal order As Integer)
- _order = order
- _name = name
- End Sub
-
- Public Function CompareTo(ByVal obj As Object) As Integer
-
-
-
-
- Dim otherOrder As Integer = DirectCast(obj, PropertyOrderPair)._order
- If otherOrder = _order Then
-
-
-
- Dim otherName As String = DirectCast(obj, PropertyOrderPair)._name
- Return String.Compare(_name, otherName)
- ElseIf otherOrder > _order Then
- Return -1
- End If
- Return 1
- End Function
- End Class
What it should be:
Line 19 should be:
Public
Overloads Function CompareTo(ByVal obj As Object) As Integer Implements IComparable.CompareTo
Enter your message below
Sign in or Join us (it's free).