public void breed(DnaDrawing other) { lock (this) { lock (other) { shuffleShapes(); other.shuffleShapes(); List <DnaShape> otherFirst = other.firstHalf; List <DnaShape> otherSnd = other.secondHalf; List <DnaShape> thisFirst = firstHalf; List <DnaShape> thisSnd = secondHalf; otherFirst.AddRange(thisSnd); thisFirst.AddRange(otherSnd); Shapes = thisFirst; other.Shapes = otherFirst; } } }
public void breed(DnaDrawing other) { lock (this) { lock (other) { shuffleShapes(); other.shuffleShapes(); List<DnaShape> otherFirst = other.firstHalf; List<DnaShape> otherSnd = other.secondHalf; List<DnaShape> thisFirst = firstHalf; List<DnaShape> thisSnd = secondHalf; otherFirst.AddRange(thisSnd); thisFirst.AddRange(otherSnd); Shapes = thisFirst; other.Shapes = otherFirst; } } }