At 8:30 PM -0700 4/14/06, Charles Ross wrote:

For instance, if I subclass FolderItem as MyFolderItem and add a LineCount method to it, how do I use it when the built-in classes return FolderItems?

You have to convert each standard FolderItem object into an instance of your subclass. You do this by giving your class a constructor that takes a FolderItem instance, and pass this into the superclass constructor. It'd look something like this:

Sub Constructor( orig As FolderItem )
  Super.Constructor( orig )
End Sub

...though I don't recall whether the FolderItem constructor is called "Constructor" or "FolderItem", so you may have to adjust. Then, whenever you have a FolderItem and want one of your MyFolderItems, you'd make one like so:

  Dim mf as New MyFolderItem( f )

where f is the FolderItem instance.

Is there a better way to do this?

Probably.  Consider an extension method instead, or perhaps a wrapper class.

HTH,
- Joe

--

Joseph J. Strout
[EMAIL PROTECTED]
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to