Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have this class that inherits an ArrayList, and I want to add a Filter Function, I want the method to return the same object (the inherited arraylist) with only some of the items depending on the value of property in the contained object that will be passed as a parameter, and I want the returned items to be the actual items of the arraylist, not a copy of them.

 

How could this be implemented? It's something like the Filter function in the datasource object.

 

This is my class:

Public Class cLineaArrayList
  Inherits ArrayList
  Default Public Shadows Property item(ByVal Index As Integer) As cLinea
     Get
        Return DirectCast(MyBase.Item(Index), cLinea)
     End Get
     Set(ByVal Value As cLinea)
        MyBase.Item(Index) = Value
     End Set
  End Property
  Public Shadows Sub Add(ByVal Value As cLinea)
     MyBase.Add(Value)
  End Sub

  'This is the function I want to create, but I don't know how to do..
  Public Function Filter(FilterIndex As Integer) as cLineaArrayList
     'I should have to scan all items and copy them, how?
  End Function
End Class

 

Thanks,

Ronq.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...