G
Guest
Hashtable has a property IsReadOnly. i can't figure out how this gets set.
It's not a property you can set directly and i can't find a constructor that
takes an RO parameter. How on earth does it get set?
More generally, is there a way i can expose a stanadrd collection as
read-only? Manager should be able to load and modify Employees internally but
when exposing it to the caller it should not let the caller change it.
i can do this by writing my own custom class (and maybe inheriting
ReadOnlyCollectionBase) but i'd rather use a built in class if one is
available
i considered keeping a normal Hashtable (or somesuch) internally and
re-casting it or cloning it to something readonly to expose but didn't find
anything suitable
i thought for a second i could add the keyword readonly in front of the
variable declaration but i have since learned the error of my ways
So is there a way to use one of the built-in collections to expose read-only
data or do i need to create my own?
-baylor
It's not a property you can set directly and i can't find a constructor that
takes an RO parameter. How on earth does it get set?
More generally, is there a way i can expose a stanadrd collection as
read-only? Manager should be able to load and modify Employees internally but
when exposing it to the caller it should not let the caller change it.
i can do this by writing my own custom class (and maybe inheriting
ReadOnlyCollectionBase) but i'd rather use a built in class if one is
available
i considered keeping a normal Hashtable (or somesuch) internally and
re-casting it or cloning it to something readonly to expose but didn't find
anything suitable
i thought for a second i could add the keyword readonly in front of the
variable declaration but i have since learned the error of my ways
So is there a way to use one of the built-in collections to expose read-only
data or do i need to create my own?
-baylor