Interface is not implemented by this class? Codebehind

J

Jason

Hello

What do I need to do to add this function to my aspx codebehind?


Public Function Compare(ByVal x As Object, ByVal y As Object) As
Integer Implements System.Collections.IComparer.Compare
' make it return this in descending order (newest first)
Return -DateTime.Compare(DirectCast(x, FileInfo).CreationTime,
DirectCast(y, FileInfo).CreationTime)
End Function


The error "Interface is not implemented by this class" is on this
entry above

Implements System.Collections.IComparer.Compare

Thank you for any help or information.
 
A

Armin Zingler

Jason said:
Hello

What do I need to do to add this function to my aspx codebehind?


Public Function Compare(ByVal x As Object, ByVal y As Object) As
Integer Implements System.Collections.IComparer.Compare
' make it return this in descending order (newest first)
Return -DateTime.Compare(DirectCast(x, FileInfo).CreationTime,
DirectCast(y, FileInfo).CreationTime)
End Function


The error "Interface is not implemented by this class" is on this
entry above

Implements System.Collections.IComparer.Compare

Thank you for any help or information.

First you have to make the class implement an interface by adding
"Implements System.Collections.IComparer":


Class XYZ
Implements System.Collections.IComparer

'...

End class

Then you can "connect" each interface member to a class member by using the
"implements" keyword at procedure level as you've already done.


Armin
 

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