Size3D.Equals Method (Object)

 

Determines whether the specified object is a Size3D structure and whether the X, Y and Z properties of the specified Object are equal to the X, Y and Z properties of this Size3D structure.

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

public override bool Equals(
	object o
)

Parameters

o
Type: System.Object

The Object to compare.

Return Value

Type: System.Boolean

true if instances are equal; otherwise, false.

true if o is a Size3D structure and is identical with this Size3D structure; 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 check if an Object and a Size3D structure are equal.

// Checks if an Object and a Size3D structure are equal using the non-static Equals method. 
// 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;

areEqual = size1.Equals(size2);
// areEqual is False

// Displaying Results
syntaxString = "areEqual = Size3D.Equals(size1, size2);";
resultType = "Boolean";
operationString = "Checking if an object and a Size3D structure are equal";
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);

.NET Framework
Available since 3.0
Return to top
Show: