ASP.net Inherited IList Class

Joined: 11/28/2008

No idea why this won't compile, gives me errors about missing interfaces. It's for ASP.net web control.

using System;
using System.Collections;
using System.ComponentModel;
using System.Web.UI;

using System;
using System.Collections;
using System.ComponentModel;
using System.Web.UI;
using myclass

namespace myclass
{

/// <summary>
/// Summary description for SwitcherCollection.
/// </summary>
[TypeConverter(typeof(ExpandableObjectConverter))]
public abstract class PanelItem
{
//private bool _isTrackingViewState;
//private StateBag _viewSate;
private string _TabText;
/// <summary>
/// Text of the Tab
/// </summary>
public string TabText
{
get {return _TabText;}
set {_TabText=value;}
}
public string PanelText
{
get {return _PanelText;}
set {_PanelText=value;}
}
}

}

public sealed class PanelCollection : IList
{
private ArrayList _Items;
private bool _isTrackingViewState;
private bool _saveAll;
internal PanelCollection()
{
_Items = new ArrayList();
}
public PanelItem this[int index]
{
get
{
return (PanelItem)_Items[index];
}
}
public int Add(PanelItem item)
{
if (item ==null)
{
throw new ArgumentNullException("item");
}
_Items.Add(item);

if (_isTrackingViewState)
{
// ((IStateManager)item).TrackViewState();
// item.SetDirty();
}

return _Items.Count -1;
}
public void Clear()
{
_Items.Clear();
if (_isTrackingViewState) _saveAll=true;
}
public void RemoveAt(int index)
{
_Items.RemoveAt(index);
if (_isTrackingViewState) _saveAll=true;
}
public void Remove(PanelItem item)
{
if (item ==null) throw new ArgumentNullException("item");
_Items.Remove(item);
if (_isTrackingViewState) _saveAll=true;
}
public void Insert (int index, PanelItem item)
{
if (item==null) throw new ArgumentNullException("item");
_Items.Insert(index, item);

if (_isTrackingViewState)
{
//((IStateManager)item).TrackViewState();
_saveAll=true;
}

}

}

Errors
'PanelCollection' does not implement interface member 'System.Collections.ICollection.Count'
'PanelCollection' does not implement interface member 'System.Collections.ICollection.CopyTo(System.Array, int)'
'PanelCollection' does not implement interface member 'System.Collections.ICollection.IsSynchronized'
'PanelCollection' does not implement interface member 'System.Collections.ICollection.SyncRoot'
'PanelCollection' does not implement interface member 'System.Collections.IEnumerable.GetEnumerator()'
'PanelCollection' does not implement interface member 'System.Collections.IList.Add(object)'
'PanelCollection' does not implement interface member 'System.Collections.IList.Contains(object)'
'PanelCollection' does not implement interface member 'System.Collections.IList.IndexOf(object)'
'PanelCollection' does not implement interface member 'System.Collections.IList.Insert(int, object)'
'PanelCollection' does not implement interface member 'System.Collections.IList.IsFixedSize'
'PanelCollection' does not implement interface member 'System.Collections.IList.IsReadOnly'
'PanelCollection' does not implement interface member 'System.Collections.IList.Remove(object)'
'PanelCollection' does not implement interface member 'System.Collections.IList.this[int]'. 'PanelCollection.this[int]' is either static, not public, or has the wrong return type.

Joined: 11/28/2008
I don't know if you solved

I don't know if you solved this yet, but here's my $.02.

When implementing an interface, you must provide the code for all of the members. This is so someone else can call your object and know that it contains those particular methods.

Joined: 11/28/2008
Please add CollectionBase

Please add CollectionBase
e.g.
public sealed class PanelCollection : CollectionBase, IList

QUOTE(i386 @ Aug 12 2005, 11:41 PM)
No idea why this won't compile, gives me errors about missing interfaces. It's for ASP.net web control.

using System;
using System.Collections;
using System.ComponentModel;
using System.Web.UI;

using System;
using System.Collections;
using System.ComponentModel;
using System.Web.UI;
using myclass

namespace myclass
{

/// <summary>
/// Summary description for SwitcherCollection.
/// </summary>
[TypeConverter(typeof(ExpandableObjectConverter))]
public abstract class PanelItem
{
//private bool _isTrackingViewState;
//private StateBag _viewSate;
private string _TabText;
/// <summary>
/// Text of the Tab
/// </summary>
public string TabText
{
get {return _TabText;}
set {_TabText=value;}
}
public string PanelText
{
get {return _PanelText;}
set {_PanelText=value;}
}
}

}

public sealed class PanelCollection : IList
{
private ArrayList _Items;
private bool _isTrackingViewState;
private bool _saveAll;
internal PanelCollection()
{
_Items = new ArrayList();
}
public PanelItem this[int index]
{
get
{
return (PanelItem)_Items[index];
}
}
public int Add(PanelItem item)
{
if (item ==null)
{
throw new ArgumentNullException("item");
}
_Items.Add(item);

if (_isTrackingViewState)
{
// ((IStateManager)item).TrackViewState();
// item.SetDirty();
}

return _Items.Count -1;
}
public void Clear()
{
_Items.Clear();
if (_isTrackingViewState) _saveAll=true;
}
public void RemoveAt(int index)
{
_Items.RemoveAt(index);
if (_isTrackingViewState) _saveAll=true;
}
public void Remove(PanelItem item)
{
if (item ==null) throw new ArgumentNullException("item");
_Items.Remove(item);
if (_isTrackingViewState) _saveAll=true;
}
public void Insert (int index, PanelItem item)
{
if (item==null) throw new ArgumentNullException("item");
_Items.Insert(index, item);

if (_isTrackingViewState)
{
//((IStateManager)item).TrackViewState();
_saveAll=true;
}

}

}

Errors
'PanelCollection' does not implement interface member 'System.Collections.ICollection.Count'
'PanelCollection' does not implement interface member 'System.Collections.ICollection.CopyTo(System.Array, int)'
'PanelCollection' does not implement interface member 'System.Collections.ICollection.IsSynchronized'
'PanelCollection' does not implement interface member 'System.Collections.ICollection.SyncRoot'
'PanelCollection' does not implement interface member 'System.Collections.IEnumerable.GetEnumerator()'
'PanelCollection' does not implement interface member 'System.Collections.IList.Add(object)'
'PanelCollection' does not implement interface member 'System.Collections.IList.Contains(object)'
'PanelCollection' does not implement interface member 'System.Collections.IList.IndexOf(object)'
'PanelCollection' does not implement interface member 'System.Collections.IList.Insert(int, object)'
'PanelCollection' does not implement interface member 'System.Collections.IList.IsFixedSize'
'PanelCollection' does not implement interface member 'System.Collections.IList.IsReadOnly'
'PanelCollection' does not implement interface member 'System.Collections.IList.Remove(object)'
'PanelCollection' does not implement interface member 'System.Collections.IList.this[int]'. 'PanelCollection.this[int]' is either static, not public, or has the wrong return type.