J
John Devlon
Hi,
Could somebody please tell me how to use Icomparable in a .NET project? Like
I was a 5 year old?
I'm trying to sort an array of objects and I can't get it to work .... How
do I modify the main class using IComparable ? How do I sort the array in
practice?
Example...
I would like to sort the array first using the zipcode, second the Lastname
and finally the age ...
Public Class Person
Private vName as String
Private vLastName as String
Private vZipcode as Integer
Private vAge as Integer
Public property Name as String
Get
Return vName
End get
Set(ByVal value As String)
vName=value
end set
end property
Public property LastName as String
Get
Return vLastName
End get
Set(ByVal value As String)
vLastName=value
end set
end property
Public property Zipcode as Integer
Get
Return vZipcode
End get
Set(ByVal value As Integer)
vZipcode=value
end set
end property
Public property Age as Integer
Get
Return vAge
End get
Set(ByVal value As Integer)
vAge=value
end set
end property
End Class
Many, many thanks
John
Could somebody please tell me how to use Icomparable in a .NET project? Like
I was a 5 year old?
I'm trying to sort an array of objects and I can't get it to work .... How
do I modify the main class using IComparable ? How do I sort the array in
practice?
Example...
I would like to sort the array first using the zipcode, second the Lastname
and finally the age ...
Public Class Person
Private vName as String
Private vLastName as String
Private vZipcode as Integer
Private vAge as Integer
Public property Name as String
Get
Return vName
End get
Set(ByVal value As String)
vName=value
end set
end property
Public property LastName as String
Get
Return vLastName
End get
Set(ByVal value As String)
vLastName=value
end set
end property
Public property Zipcode as Integer
Get
Return vZipcode
End get
Set(ByVal value As Integer)
vZipcode=value
end set
end property
Public property Age as Integer
Get
Return vAge
End get
Set(ByVal value As Integer)
vAge=value
end set
end property
End Class
Many, many thanks
John