c# - Avoiding a null reference exception on a variable in a foreach loop that could be null -
I have a Quattree whose withdrawal method, and every time I remove an item from the game, Call me The problem is that in the Here is the remove method. If the value is empty then I should not loop through the children in the You are already checking that each If any foreach loop, the hair variable is zero. How can I disrupt this method if this variable is redundant then it will not give me any errors?
Private zero is narrowed (rectangular in node). {If (child == zero) {return; } While (child.Items.Count> gt; {} {MoveUp (child.Items [0]); }} Node. Hair = null; }
Remove private zeros (rectangular nodes, item items) {node.Items.Remove (item); item. Original = null; While (node! = Null) {node.ItemCount--; If (node.imit Marks & lt; 6) {CollapseChildren (node); } Node = node. Parent; }}
nodes. Children because if I loop I find that there is no child in the meaning of error node on child variable.
child is
Null .
nodes > {If (node.children == null) return; Foreign Hair (Rectangular Children in Nodes.) Children ... {... ...}}
Comments
Post a Comment