public ICrossBoard Clone() { var result = new CrossBoard(_sizeX, _sizeY); result._startWords.AddRange(_startWords); result._horizontalPatterns = new List <CrossPattern>(); foreach (var patt in _horizontalPatterns) { result._horizontalPatterns.Add((CrossPattern)patt.Clone()); } result._verticalPatterns = new List <CrossPattern>(); foreach (var patt in _verticalPatterns) { result._verticalPatterns.Add((CrossPattern)patt.Clone()); } result.BindAdjacentPatterns(); return(result); }
public ICrossBoard Clone() { var result = new CrossBoard(); result.SetBoardSize(_sizeX, _sizeY); result._startWords.AddRange(_startWords); if (_horizontalPatterns != null && _verticalPatterns != null) { result._horizontalPatterns = new List <CrossPattern>(); foreach (var horPattern in _horizontalPatterns) { result._horizontalPatterns.Add((CrossPattern)horPattern.Clone()); } result._verticalPatterns = new List <CrossPattern>(); foreach (var verPattern in _verticalPatterns) { result._verticalPatterns.Add((CrossPattern)verPattern.Clone()); } result.BindAdjacentPatterns(); } return(result); }