Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / Base / Shared / Internal / EqualityArray.cs / 1305376 / EqualityArray.cs
namespace System.Activities.Presentation.Internal { using System.Diagnostics; using System.Runtime; // // An EqualityArray is an array of objects whose // .Equals method runs against all items in the // array. It is assumed that the data input // into the array is constant. We use this in attributes // to offer a quick and accurate TypeId property. // internal class EqualityArray { private object[] _values; internal EqualityArray(params object[] values) { _values = values; Fx.Assert(_values != null && _values.Length > 0, "EqualityArray expects at least one value"); } public override bool Equals(object other) { EqualityArray otherArray = other as EqualityArray; if (otherArray == null) return false; if (otherArray._values.Length != _values.Length) return false; for (int idx = 0; idx < _values.Length; idx++) { if (_values[idx] != otherArray._values[idx]) return false; } return true; } public override int GetHashCode() { return _values[0].GetHashCode(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. namespace System.Activities.Presentation.Internal { using System.Diagnostics; using System.Runtime; // // An EqualityArray is an array of objects whose // .Equals method runs against all items in the // array. It is assumed that the data input // into the array is constant. We use this in attributes // to offer a quick and accurate TypeId property. // internal class EqualityArray { private object[] _values; internal EqualityArray(params object[] values) { _values = values; Fx.Assert(_values != null && _values.Length > 0, "EqualityArray expects at least one value"); } public override bool Equals(object other) { EqualityArray otherArray = other as EqualityArray; if (otherArray == null) return false; if (otherArray._values.Length != _values.Length) return false; for (int idx = 0; idx < _values.Length; idx++) { if (_values[idx] != otherArray._values[idx]) return false; } return true; } public override int GetHashCode() { return _values[0].GetHashCode(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HostVisual.cs
- WithStatement.cs
- ImageDrawing.cs
- figurelength.cs
- ImageListStreamer.cs
- SourceFileInfo.cs
- ScriptComponentDescriptor.cs
- AdapterDictionary.cs
- XmlSchemaSimpleContentExtension.cs
- bindurihelper.cs
- RowUpdatingEventArgs.cs
- dataprotectionpermissionattribute.cs
- MaterialGroup.cs
- BorderGapMaskConverter.cs
- HwndSubclass.cs
- XmlSchemaIdentityConstraint.cs
- ChildrenQuery.cs
- DBCSCodePageEncoding.cs
- ListItemConverter.cs
- SerialErrors.cs
- unsafenativemethodstextservices.cs
- CreatingCookieEventArgs.cs
- ListItemCollection.cs
- MobileControlsSection.cs
- PropertyTabAttribute.cs
- ResourceReferenceExpressionConverter.cs
- LicFileLicenseProvider.cs
- Enum.cs
- EditorPartChrome.cs
- DebugView.cs
- CompareInfo.cs
- GestureRecognitionResult.cs
- SqlXml.cs
- DynamicValueConverter.cs
- HttpListenerPrefixCollection.cs
- WebPartConnectionsEventArgs.cs
- XmlSortKeyAccumulator.cs
- XmlSerializerFactory.cs
- SignerInfo.cs
- ObjectViewFactory.cs
- HashCodeCombiner.cs
- ReflectionServiceProvider.cs
- PreDigestedSignedInfo.cs
- WindowsGraphicsCacheManager.cs
- MatrixTransform3D.cs
- MailSettingsSection.cs
- MultiAsyncResult.cs
- StaticSiteMapProvider.cs
- ComponentConverter.cs
- PieceNameHelper.cs
- SizeValueSerializer.cs
- Geometry3D.cs
- SecurityTokenTypes.cs
- ReceiveActivityDesigner.cs
- DefaultHttpHandler.cs
- HtmlControl.cs
- EntityDataReader.cs
- TextEditorParagraphs.cs
- _RequestCacheProtocol.cs
- PenLineJoinValidation.cs
- EntityDataSourceUtil.cs
- MimeFormImporter.cs
- StringToken.cs
- OleDbInfoMessageEvent.cs
- MethodImplAttribute.cs
- LassoSelectionBehavior.cs
- xsdvalidator.cs
- LifetimeServices.cs
- EncodingNLS.cs
- SoapIncludeAttribute.cs
- ImageSource.cs
- Bind.cs
- SelectionChangedEventArgs.cs
- RolePrincipal.cs
- COM2ComponentEditor.cs
- Comparer.cs
- SafeNativeMethodsOther.cs
- SqlClientPermission.cs
- SetterBaseCollection.cs
- SqlConnectionHelper.cs
- DataColumnMappingCollection.cs
- DataGridViewSelectedRowCollection.cs
- ResolveNameEventArgs.cs
- StreamWriter.cs
- CheckBoxPopupAdapter.cs
- EditorPartChrome.cs
- ResourcesBuildProvider.cs
- ManualResetEventSlim.cs
- DragEventArgs.cs
- ResponseBodyWriter.cs
- TextEvent.cs
- PrintController.cs
- MsmqElementBase.cs
- DataSvcMapFile.cs
- MenuItem.cs
- MenuItemBindingCollection.cs
- DesignOnlyAttribute.cs
- RunClient.cs
- DataGridViewCellConverter.cs
- ItemCollection.cs