[Gtk-sharp-list] Design for Indexer for GLib.List to allow []
based addressing.
Daniel Kornhauser
dkor@media.mit.edu
Fri, 24 Oct 2003 18:38:05 -0400
The change is only four miserable lines in ListBase.cs:
internal ListBase (System.Type element_type)
{
list_ptr = (IntPtr) 0;
this.element_type = element_type;
}
one line in SList.cs :
public SList (System.Type element_type) : base (element_type)
{
}
and one line in List.cs:
public List (System.Type element_type) : base (element_type)
{
}
I tested it and it works alright should I commit this too ?
(When/If I get miguel's cvs account)
Sorry for the stupid question, but should I even be asking if I have to
make the commit, since mkenster didn't make a negative comment on Joe's
suggestion ?
I want to avoid making unnecessary noise on the list.
Daniel
On Thu, 2003-10-23 at 17:39, Joe Shaw wrote:
> This isn't really related to your patch directly, but since you're in
> that code... :)
>
> > GLib.List l = new GLib.List ((IntPtr) 0, typeof (Gtk.Widget));
> > GLib.SList sl = new GLib.SList ((IntPtr) 0, typeof (Gtk.Widget));
>
> This is a pretty nasty API. Maybe we should add another constructor
> which just takes the type?
>
> Ie, add a:
>
> internal ListBase (System.Type element_type)
> {
> this.element_type = element_type;
> }
>
> to ListBase.cs and then suitable ctors to List.cs and SList.cs.
>
> Then you could do:
>
> GList.List l = new GLib.List (typeof (Gtk.Widget));
>
> which offends my delicate sensibilities less.
>
> Joe