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
- WebBrowserHelper.cs
- OracleCommandSet.cs
- JsonReaderDelegator.cs
- DBPropSet.cs
- TraceSection.cs
- xmlformatgeneratorstatics.cs
- ContainerControl.cs
- RequestCache.cs
- PartitionResolver.cs
- DataControlPagerLinkButton.cs
- _AutoWebProxyScriptWrapper.cs
- SqlConnectionFactory.cs
- SHA1CryptoServiceProvider.cs
- EntityProviderFactory.cs
- Camera.cs
- ToolStripCollectionEditor.cs
- QilLiteral.cs
- ConstantSlot.cs
- ValueUnavailableException.cs
- CompilerLocalReference.cs
- InfoCardSymmetricCrypto.cs
- CultureInfoConverter.cs
- BuildManagerHost.cs
- SpeechUI.cs
- TrackingStringDictionary.cs
- TagPrefixInfo.cs
- WindowsFormsDesignerOptionService.cs
- DesignTimeParseData.cs
- Selection.cs
- ExpressionNode.cs
- DashStyle.cs
- PlanCompilerUtil.cs
- ContextItemManager.cs
- ModelUIElement3D.cs
- FormatterServicesNoSerializableCheck.cs
- JsonServiceDocumentSerializer.cs
- IPipelineRuntime.cs
- _FtpDataStream.cs
- FileDialog.cs
- DirtyTextRange.cs
- UserPersonalizationStateInfo.cs
- EventLogLink.cs
- TraceUtility.cs
- XmlDataImplementation.cs
- DetailsViewCommandEventArgs.cs
- MDIWindowDialog.cs
- GroupStyle.cs
- ColorAnimation.cs
- WizardPanel.cs
- lengthconverter.cs
- Logging.cs
- KeyToListMap.cs
- SubclassTypeValidatorAttribute.cs
- _ProxyChain.cs
- CodeTypeDeclarationCollection.cs
- Number.cs
- CommentEmitter.cs
- DataBoundControlDesigner.cs
- WpfPayload.cs
- TrackingMemoryStreamFactory.cs
- RequiredFieldValidator.cs
- XmlSchemaAnnotated.cs
- DurableMessageDispatchInspector.cs
- DecoderBestFitFallback.cs
- OverflowException.cs
- AffineTransform3D.cs
- UrlAuthorizationModule.cs
- WindowsAuthenticationModule.cs
- BooleanFacetDescriptionElement.cs
- TableLayoutSettings.cs
- KeyEvent.cs
- DataContractSerializerServiceBehavior.cs
- BuildManagerHost.cs
- DataStreams.cs
- CryptoApi.cs
- ListViewUpdateEventArgs.cs
- Formatter.cs
- PackWebRequest.cs
- PathGeometry.cs
- XmlWrappingReader.cs
- ListItemConverter.cs
- ResourceDescriptionAttribute.cs
- BitmapPalette.cs
- SaveFileDialog.cs
- PauseStoryboard.cs
- URLString.cs
- HitTestFilterBehavior.cs
- _SingleItemRequestCache.cs
- FamilyMap.cs
- DataGridItem.cs
- WebGetAttribute.cs
- Point.cs
- HtmlInputButton.cs
- SettingsAttributes.cs
- Html32TextWriter.cs
- UpdatePanel.cs
- CompiledQueryCacheEntry.cs
- XmlSchemaSimpleContentRestriction.cs
- DecoderFallback.cs
- CollectionViewProxy.cs