[Gtk-sharp-list] Design for Indexer for GLib.List to allow []
based addressing.
Mike Kestner
mkestner@speakeasy.net
Wed, 22 Oct 2003 10:19:44 -0500
Hi Daniel,
Nice summary. :)
On Tue, 2003-10-21 at 15:39, Daniel Kornhauser wrote:
> The code :
> ==========
>
> In ListBase.cs
You'll need an:
abstract internal IntPtr NthData (uint index);
declaration here to implement in the subclasses.
>
> public object this[int index] {
> get {
> IntPtr data = list.NthData (index);
IntPtr data = NthData (index);
> object ret = null;
> if (list.element_type != null)
> {
<snip>
>
> In List.cs
>
> [DllImport("libglib-2.0-0.dll")]
> static extern IntPtr g_list_nth_data (IntPtr l, uint n);
>
> internal override IntPtr g_list_nth_data NthData (IntPtr list, uint n)
internal override IntPtr NthData (uint n)
> {
> return g_list_nth_data ();
return g_list_nth_data (Handle, n);
> }
And of course, the above change needs to be added to SList.cs as well.
So the approach looks right. Can you work up a patch to add it?
Thanks,
--
Mike Kestner <mkestner@speakeasy.net>