Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Folder
- {
- //Various Props like Name etc.
- public IList<Folder> Children{get;}
- public Folder Parent {get;}
- }
- List<Folder> children;
- public ReadOnlyCollection<Folder> Children
- {
- get { return this.children.AsReadOnly(); }
- }
- IList<Folder> children;
- public ReadOnlyCollection<Folder> Children
- {
- get
- {
- return new List<Folder>(this.children).AsReadOnly();
- }
- }
- public class ChildCollection
- {
- // _Children is maintained by the Folder class, hence the internal access specifier
- internal Dictionary<KeyType, Folder> _Children = new Dictionary<KeyType, Folder>;
- public this[KeyType key]
- {
- get
- {
- return _Children[key];
- }
- }
- public IEnumerable<KeyType> Keys
- {
- get
- {
- return _Children.Keys;
- }
- }
- }
- public IEnumerable<Folder> Children
- {
- get { return this.children.GetEnumerator(); }
- }
Add Comment
Please, Sign In to add comment