// this basically checks if the master tool list already contains this tool and // returns that tool if it does, otherwise it adds the tool to the master Tool list // and returns it. Tool GetTool(uint index, Tool.ToolType toolType) { Tool newTool = new Tool(index, toolType); Tool tool = parent.Tools.Find(a => a.Equals(newTool)); if (tool == null) { tool = newTool; parent.Tools.Add(tool); } return(tool); }
// this basically checks if the master tool list already contains this tool and // returns that tool if it does, otherwise it adds the tool to the master Tool list // and returns it. Tool GetTool(uint index, Tool.ToolType toolType) { var newTool = new Tool(index, toolType); var tool = Parent.Tools.Find(a => a.Equals(newTool)); if (tool == null) { tool = newTool; Parent.Tools.Add(tool); } return(tool); }