# Method Difference

#### Difference(Geometry, Geometry)

Constructs the set-theoretic difference between two geometries.

##### Declaration

`public static Geometry Difference(this Geometry geometry1, Geometry geometry2)`

##### Parameters

Type | Name | Description |
---|---|---|

Geometry | geometry1 | is the Geometry instance on the left hand side of the subtraction. |

Geometry | geometry2 | is the Geometry on the right hand side being subtracted. |

##### Returns

Type | Description |
---|---|

Geometry | Returns the result of subtraction. The result has the dimension of the |

##### Remarks

The GeometryEngine.Difference method performs a spatial subtraction from the two input geometries. This means that the order of the two input geometry
arguments of the GeometryEngine.Difference Static Method will have different results if they are switched. In a theoretical variable format
you can think of the GeometryEngine.Difference equation like:

A (Difference) B = C

B (Difference) A = D

If you were looking for the "symmetric" difference between two geometries you will need to run the GeometryEngine.Difference
twice by switching the order of the input arguments and then add the two resultant geometries together (most likely via the
GeometryEngine.Union
Static Method). This "symmetric" difference
means that you would be interested in obtaining those parts of the two input geometries that do not overlap. In a theoretical
variable format to get the "symmetric" different between two geometries you can think of the GeometryEngine.Difference equation like:

[A (Difference) B] + [B (Difference) A] = Symmetric Difference

If you desire not to compute the "symmetric" difference using the step-by-step process just described, you could use the SymmetricDifference(Geometry, Geometry) method instead.

The following is a visual illustration of two polygon geometries and how the output result would be from the GeometryEngine.Difference operation:

Supports true curves.

##### See Also

### Applies to

## Platforms and versions

Target | Versions |
---|---|

.NET Standard 2.0 | 100.3 - 200.5 |

.NET | 100.13 - 200.5 |

.NET Windows | 100.13 - 200.5 |

.NET Android | 200.0 - 200.5 |

.NET iOS | 200.0 - 200.5 |

.NET Framework | 100.0 - 200.5 |

Xamarin.Android | 100.0 - 100.15 |

Xamarin.iOS | 100.0 - 100.15 |

UWP | 100.0 - 200.5 |