Condividi tramite


Equals

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Checks for equality of an object to the current object.

retval = object.Equals(objectToCompare)

Arguments

objectToCompare

object

The object to compare to the calling object.

Return Value

Type: Boolean

true if the objects are the same object; otherwise, false.

Managed Equivalent

Each managed type (particularly structures) often implements its own definition of Equals, but the base definition is on Object.

Remarks

Equality is determined by reference equality. In Silverlight JavaScript programming, this applies even if you compare two instances, such as Point objects, that have identical string initialization for their internal values. In other words, if you create two Point instances with X,Y values of (0,0), they will not evaluate as being equal for this implementation of the Equals method.

Some of the object types listed in the Applies To section are abstract types. The Equals method cannot truly be called on those types in JavaScript because there is no way to obtain instances of abstract types in JavaScript programming.

Applies To

Accessibility Object (Silverlight JSAPI)

ArcSegment

BeginStoryboard

BezierSegment

BitmapImage (Silverlight 2)

Border (Silverlight 2)

Brush (abstract)

Canvas

Color

ColorAnimation

ColorAnimationUsingKeyFrames

ColorKeyFrame (abstract)

ColorKeyFrameCollection

DeepZoomImageTileSource (Silverlight 2)

DependencyObject (abstract)

DiscreteColorKeyFrame

DiscreteDoubleKeyFrame

DiscreteObjectKeyFrame (Silverlight 2)

DiscretePointKeyFrame

DoubleAnimation

DoubleAnimationUsingKeyFrames

DoubleKeyFrame (abstract)

DoubleKeyFrameCollection

Downloader

DrawingAttributes

Duration

Ellipse

EllipseGeometry

EventTrigger

Geometry (abstract)

GeometryCollection

GeometryGroup

Glyphs

GradientStop

GradientStopCollection

Image

ImageBrush

InkPresenter

Inlines

KeySpline

KeyTime

Line

LinearColorKeyFrame

LinearDoubleKeyFrame

LinearGradientBrush

LinearPointKeyFrame

LineBreak

LineGeometry

LineSegment

Matrix

MatrixTransform

MediaAttribute

MediaAttributeCollection

MediaElement

MultiScaleImage (Silverlight 2)

ObjectAnimationUsingKeyFrames (Silverlight 2)

ObjectKeyFrameCollection (Silverlight 2)

PasswordBox (Silverlight 2)

Path

PathFigure

PathFigureCollection

PathGeometry

PathSegment (abstract)

PathSegmentCollection

Point

PointAnimation

PointAnimationUsingKeyFrames

PointKeyFrame (abstract)

PointKeyFrameCollection

PolyBezierSegment

Polygon

Polyline

PolyLineSegment

PolyQuadraticBezierSegment

Popup (Silverlight 2)

QuadraticBezierSegment

RadialGradientBrush

Rect

Rectangle

RectangleGeometry

RepeatBehavior

ResourceDictionary

RotateTransform

Run

RuntimeErrorEventArgs

ScaleTransform

SkewTransform

SolidColorBrush

SplineColorKeyFrame

SplineDoubleKeyFrame

SplinePointKeyFrame

StackPanel (Silverlight 2)

Storyboard

Stroke

StrokeCollection

StylusInfo

StylusPoint

StylusPointCollection

TextBlock

TextBox (Silverlight 2)

Timeline (abstract)

TimelineCollection

TimelineMarker

TimelineMarkerCollection

TimelineMarkerEventArgs

TimeSpan

TransformCollection

TransformGroup

TranslateTransform

TriggerActionCollection

TriggerCollection

VisualCollection

VideoBrush

See Also

Reference