Link to home
Start Free TrialLog in
Avatar of Eindoofus
Eindoofus

asked on

Seeking an explanation of how a "ReadOnlyCollection" works in this given case?

I'm trying to find out what is happening in the following lines and I'm new to the "ReadyOnlyCollection." I was hoping someone could explain it to me. I'm especially confused about the line:

_children = new ReadOnlyCollection<Node>(_intChildren);
public Node Parent { get; }
private List<Node> _intChildren;
private ReadOnlyCollection<Node> _children;
public ReadOnly Collection<Node> Children
{
   get 
   {
      if (_children == null)
         _children = new ReadOnlyCollection<Node>(_intChildren);
      return _children;
   }
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Eindoofus
Eindoofus

ASKER

Thanks :)