public bool Equals(Diff obj) { // If parameter is null return false. if (obj == null) { return false; } // Return true if the fields match. return obj.operation == this.operation && obj.text == this.text; }
/** * Given an array of patches, return another array that is identical. * @param patches Array of Patch objects. * @return Array of Patch objects. */ public List<Patch> patch_deepCopy(List<Patch> patches) { List<Patch> patchesCopy = new List<Patch>(); foreach (Patch aPatch in patches) { Patch patchCopy = new Patch(); foreach (Diff aDiff in aPatch.diffs) { Diff diffCopy = new Diff(aDiff.operation, aDiff.text); patchCopy.diffs.Add(diffCopy); } patchCopy.start1 = aPatch.start1; patchCopy.start2 = aPatch.start2; patchCopy.length1 = aPatch.length1; patchCopy.length2 = aPatch.length2; patchesCopy.Add(patchCopy); } return patchesCopy; }