J
jjsavage
Hi all,
I've got a MyList class that implements the IList<string>
interface. I can do all the IList-specific methods, but when I try to
do the ICollection ones, it says
"Error: 'Form1.MyList' does not implement interface member
'System.Collections.Generic.ICollection<string>.Add(string)'.
'MyList.Add(string)' is either static, not public, or has the wrong
return type."
Here's my Add method (list is the private member that holds the list):
public int Add(string s) {
list.addItem(s);
return list.getCount() - 1; // new item goes at end of
list
}
The help file says that Add takes an object of the type of the IList
(or ICollection), and returns an int (specifically, the position at
which the new item was added). Why does it say it's 'static, not
public, or has the wrong return type' when it's NOT static, it IS
public, and it DOES have the right return type?
Thanks,
Johon
I've got a MyList class that implements the IList<string>
interface. I can do all the IList-specific methods, but when I try to
do the ICollection ones, it says
"Error: 'Form1.MyList' does not implement interface member
'System.Collections.Generic.ICollection<string>.Add(string)'.
'MyList.Add(string)' is either static, not public, or has the wrong
return type."
Here's my Add method (list is the private member that holds the list):
public int Add(string s) {
list.addItem(s);
return list.getCount() - 1; // new item goes at end of
list
}
The help file says that Add takes an object of the type of the IList
(or ICollection), and returns an int (specifically, the position at
which the new item was added). Why does it say it's 'static, not
public, or has the wrong return type' when it's NOT static, it IS
public, and it DOES have the right return type?
Thanks,
Johon