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
- DataGridViewCellErrorTextNeededEventArgs.cs
- SortDescription.cs
- PaginationProgressEventArgs.cs
- DynamicMethod.cs
- WorkerRequest.cs
- QueryConverter.cs
- ToolboxComponentsCreatingEventArgs.cs
- PageParserFilter.cs
- CodeDOMProvider.cs
- xmlfixedPageInfo.cs
- FixUpCollection.cs
- RenamedEventArgs.cs
- FormsAuthenticationCredentials.cs
- SamlEvidence.cs
- BitSet.cs
- WmpBitmapDecoder.cs
- CharConverter.cs
- GeneralTransform3DCollection.cs
- UriExt.cs
- Funcletizer.cs
- TrackingStringDictionary.cs
- GrabHandleGlyph.cs
- InstanceCreationEditor.cs
- PerformanceCounterManager.cs
- RootContext.cs
- RedBlackList.cs
- DesignerInterfaces.cs
- TableItemStyle.cs
- SecurityElementBase.cs
- ProviderConnectionPointCollection.cs
- Icon.cs
- CharacterShapingProperties.cs
- CroppedBitmap.cs
- Delay.cs
- XmlQuerySequence.cs
- FixedPageAutomationPeer.cs
- CollectionTypeElement.cs
- MarkupCompilePass1.cs
- ExceptionUtil.cs
- NameValuePair.cs
- Geometry.cs
- ApplicationFileParser.cs
- Properties.cs
- Floater.cs
- MonthCalendar.cs
- HtmlHead.cs
- FlatButtonAppearance.cs
- ConnectionsZone.cs
- DbSetClause.cs
- SecurityKeyUsage.cs
- TracedNativeMethods.cs
- ApplicationId.cs
- GroupDescription.cs
- Margins.cs
- HwndProxyElementProvider.cs
- HorizontalAlignConverter.cs
- Gdiplus.cs
- SoapSchemaImporter.cs
- BaseTemplateCodeDomTreeGenerator.cs
- ProviderUtil.cs
- Debugger.cs
- UseAttributeSetsAction.cs
- XmlSchemaValidationException.cs
- Int16Converter.cs
- AppSettingsExpressionBuilder.cs
- InvokeMethodActivityDesigner.cs
- DocumentViewerHelper.cs
- ReadOnlyCollection.cs
- SqlCommand.cs
- SourceItem.cs
- OleDbConnectionInternal.cs
- RegionInfo.cs
- MetaType.cs
- tooltip.cs
- ColorKeyFrameCollection.cs
- UnitySerializationHolder.cs
- SemanticResultKey.cs
- GenerateScriptTypeAttribute.cs
- UnsafeCollabNativeMethods.cs
- MaskedTextBoxTextEditor.cs
- LinkButton.cs
- DefaultSerializationProviderAttribute.cs
- LineSegment.cs
- XsdBuilder.cs
- BaseTreeIterator.cs
- CalloutQueueItem.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- SqlClientMetaDataCollectionNames.cs
- TitleStyle.cs
- ImageFormatConverter.cs
- FtpWebRequest.cs
- Matrix.cs
- XsdValidatingReader.cs
- WorkItem.cs
- ConfigXmlSignificantWhitespace.cs
- CaseDesigner.xaml.cs
- XmlArrayItemAttribute.cs
- coordinator.cs
- ActivityStatusChangeEventArgs.cs
- BamlReader.cs