Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Color.Equals Method (Color, Color)

Tests whether two Color structures are identical.

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

public static bool Equals (
	Color color1,
	Color color2
public static boolean Equals (
	Color color1, 
	Color color2
public static function Equals (
	color1 : Color, 
	color2 : Color
) : boolean
You cannot use methods in XAML.



The first Color structure to compare.


The second Color structure to compare.

Return Value

true if color1 and color2 are equal; otherwise, false.

Floating point values can acquire a small degree of error when they are operated upon. The Equals method, the overloaded equality operator, and the overloaded inequality operator will will not compensate for this and thus may not return the expected boolean result.

The AreClose method uses a fuzzy equality algorithm that will compensate for this floating point arithmetic error by returning true for a comparison of two Color structures that are logically true, but whose values may differ by a miniscule amount.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

© 2017 Microsoft