Sponsorlu Bağlantılar
This example shows how to easily create a read-only wrapper for a collection. This is useful if you have a private collection (with full access) and you need to show it as a read-only collection for the public.
In the example bellow, there is a class with private collection
[C#]List<int> _items
and public property IList<int> Items
which is the readonly wrapper to the private collection.public class MyClass { private List<int> _items = new List<int>(); public IList<int> Items { get { return _items.AsReadOnly(); } } }
Sponsorlu Bağlantılar
Hiç yorum yok:
Yorum Gönder