Interfaces, What am I missing?

  • Thread starter Thread starter John Baro
  • Start date Start date
J

John Baro

If I have a class that implements IList.
This puts all the add / remove etc.. methods in but they are all private as
in
int IList.Add(object value)

This is a problem because I want it to be public but when I try public it
says

Modifier public not valid for item.

What am I missing?

JB
 
Thanks Michael
I presume you can still cast it back to IList after doing this.
Ill try it.
Yep. :)
Excellent
Cheers
JB

BTW
Where are you?
I live in the outer eastern suburbs of Melbourne.
 
On an interface you don't get to decide accessibility; the fact that a
member is part of an interface means, by definition, that that member is
'visible' if you have a reference to an implementer of that interface.

Richard
 
John Baro said:
Thanks Michael
I presume you can still cast it back to IList after doing this.

If it's defined as IList.Add then it can only be accessed through an variable of type IList. If you use Public Add then it is
accessible through a variable of type IList or of the type of your class.
I live in the outer eastern suburbs of Melbourne.

Me too. Did you know somehow?
 
Your Email Add gives the country away.
JB
3138

Michael Culley said:
If it's defined as IList.Add then it can only be accessed through an
variable of type IList. If you use Public Add then it is
 
Back
Top