By collections editor I mean the dialog that pops up, for example, when you
are editing the tabs of a tab Control.  You get this on any User Control
that where you have a property that returns a Collection of something.

This really touches on the absence of template types in C#.  To get strongly
typed collections, you have to derive from CollectionBase.  However, all
necessary collection actions are implemented in CollectionBase so if my type
requires no special handling I shouldn't need to implement a special
Collection.  I should be able to return a CollectionBase from my property
and use an attribute to specify what type the editor should treat it as.

public CollectionBase m_Tabs;

....code...

[CollectionsEditor(Type.GetType("TabClass"))]
public CollectionBase Tabs {
        get { return m_Tabs; }
        set { m_Tabs = value; }
}

Of course CollectionEditor attr does not exist.  I guess it would be
inconvenient to access the Tabs property
given the above code as objects would be returned as object and not as Tabs.
Oh well, just feels stupid to implement a collection class when you are
adding no code whatsoever, just calling into the base for each method.
That's Reggie's Design Methodology -- if it feels wrong it probably is.  :-D

Reggie

-----Original Message-----
From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of
Chris Sells
Sent: Friday, April 12, 2002 9:03 PM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Collections Editor question


What's the "collections editor?"

Chris Sells
http://www.sellsbrothers.com/

> -----Original Message-----
> From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf
Of
> Reggie Burnett
> Sent: Friday, April 12, 2002 6:27 PM
> To: [EMAIL PROTECTED]
> Subject: [DOTNET] Collections Editor question
>
> Do I have to derive from CollectionsBase to get the collections editor
to
> properly edit my types in the IDE?  That doesn't make sense.  I should
be
> able to use a simple built in array class to hold my objects and then
use an
> attribute to tell the compiler what object the editor to construct for
the
> array.  What am I missing?
>
> I implemented a custom collection and the editor did work but all of
the
> member implementations on the collection just simply called into the
same
> base method.  No new functionality at all.  Why oh why do I have to
write
> code that adds no functionality just to get the editor to work?
>
> Reggie
>
> You can read messages from the DOTNET archive, unsubscribe from
DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to