Compile error help

  • Thread starter Flomo Togba Kwele
  • Start date
F

Flomo Togba Kwele

I wrote the following class:

Public Class CassPrintComparer2
Implements IComparer(Of ICASSPrint)

Private _sortDescending As Boolean = False

'pass true to the constructor to sort descending
Public Sub New(ByVal descending As Boolean)

_sortDescending = descending

End Sub

Public Function Compare(ByVal x As MailHouse2.DataAccess.ICASSPrint, ByVal y
As MailHouse2.DataAccess.ICASSPrint) As Integer

If (_sortDescending) Then
Return y.SerialNo.CompareTo(x.SerialNo)
Else
Return x.SerialNo.CompareTo(y.SerialNo)
End If

End Function

End Class

I get the following syntax error which I cannot figure out:

Error - Class 'CassPrintComparer2' must implement 'Function Compare(x As
MailHouse2.DataAccess.ICASSPrint, y As MailHouse2.DataAccess.ICASSPrint) As
Integer' for interface 'System.Collections.Generic.IComparer(Of ICASSPrint)'.

I just cannot see what I've done wrong. The IDE puts the squiggly error line
under IComparer(Of ICASSPrint).

Thanks, Flomo
 
G

Guest

Flomo,

I think the syntax is:

Public Function Compare(ByVal x As MailHouse2.DataAccess.ICASSPrint, ByVal y
As MailHouse2.DataAccess.ICASSPrint) As Integer Implements IComparer(Of
ICASSPrint).Compare

Kerry Moorman
 

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

Top