David Klempfner
David Klempfner

Reputation: 9940

Why is IsReadOnly listed as a non-public member?

I'm looking at an instance of ICollection called pxe in the VS Watch window. I understand that the Raw View is meant to show the object without anything extra added. The property IsReadOnly is a member of the ICollection interface and is public by default. Why is it listed in the Non-public members in the Watch window?

enter image description here

Upvotes: 0

Views: 75

Answers (1)

Gary Chan
Gary Chan

Reputation: 146

ReadonlyCollection<T> implements both IList and ICollection<T> and both interfaces contains IsReadOnly property. ReadonlyCollection<T> implements this property explicitly, so you cannot access it without casting ReadonlyCollection<T> to IList or ICollection<T>, and so visual studio treat it as non-public member

Upvotes: 3

Related Questions