Size3D.Equality Operator

Compares two Size3D structures for equality. Two Size3D structures are equal if the values of their X, Y, and Z properties are the same.

Namespace:  System.Windows.Media.Media3D
Assembly:  PresentationCore (in PresentationCore.dll)

public static bool operator ==(
	Size3D size1,
	Size3D size2


Type: System.Windows.Media.Media3D.Size3D

The first Size3D structure to compare.

Type: System.Windows.Media.Media3D.Size3D

The second Size3D structure to compare.

Return Value

Type: System.Boolean
true if the X, Y, and Z components of size1 and size2 are equal; otherwise, false.

Because Double values can lose precision when arithmetic operations are performed on them, a comparison between two Size3D instances that are logically equal might fail.

The following example shows how to use the overloaded equality operator to check if two Size3D structures are equal.

                        // Checks if two Size3D structures are equal using the overloaded == operator.  
                        // Returns a Boolean. 

                        // Declaring Size3D structure without initializing x,y,z values
                        Size3D size1 = new Size3D();

                        // Declaring Size3D structure and initializing x,y,z values
                        Size3D size2 = new Size3D(5, 10, 15);
                        Boolean areEqual;

                        // Assigning values to size1
                        size1.X = 2;
                        size1.Y = 4;
                        size1.Z = 6;

                        // Checking for equality
                        areEqual = size1 == size2;

                        // areEqual is False 

                        // Displaying Results
                        syntaxString = " areEqual = size1 == size2;";
                        resultType = "Boolean";
						operationString = "Checking if two Size3D structures are equal";
						ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft