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
- ImmutableObjectAttribute.cs
- HttpChannelBindingToken.cs
- BindableTemplateBuilder.cs
- Models.cs
- XpsFilter.cs
- ActiveDesignSurfaceEvent.cs
- safemediahandle.cs
- ActivityContext.cs
- Size.cs
- ObjectDataSourceDesigner.cs
- SqlLiftIndependentRowExpressions.cs
- XmlSchemaAttribute.cs
- Rect.cs
- ClientReliableChannelBinder.cs
- ProfilePropertySettings.cs
- ScriptManager.cs
- ValidationSettings.cs
- PasswordTextContainer.cs
- LiteralControl.cs
- DataGridViewCellConverter.cs
- PostBackOptions.cs
- IIS7ConfigurationLoader.cs
- RadioButton.cs
- XmlSequenceWriter.cs
- EntitySqlQueryBuilder.cs
- IgnoreFileBuildProvider.cs
- Figure.cs
- ResourceDefaultValueAttribute.cs
- Timer.cs
- DataGridRow.cs
- ADMembershipProvider.cs
- WebPartConnectionsConfigureVerb.cs
- TitleStyle.cs
- SaveRecipientRequest.cs
- Scripts.cs
- DebuggerAttributes.cs
- Token.cs
- MethodImplAttribute.cs
- RuleInfoComparer.cs
- WebPartManagerDesigner.cs
- dbenumerator.cs
- AuthorizationSection.cs
- SystemResourceHost.cs
- EntityDataSourceChangingEventArgs.cs
- XmlRawWriterWrapper.cs
- AmbientLight.cs
- ComplexBindingPropertiesAttribute.cs
- AbstractSvcMapFileLoader.cs
- ExtensionSimplifierMarkupObject.cs
- WindowsStatusBar.cs
- CodeCompileUnit.cs
- InputLangChangeRequestEvent.cs
- ConnectionProviderAttribute.cs
- ToolBar.cs
- QueueNameHelper.cs
- FixedPageAutomationPeer.cs
- DbProviderConfigurationHandler.cs
- InvokePattern.cs
- MenuItemStyle.cs
- TablePatternIdentifiers.cs
- IdnElement.cs
- ProxyWebPartConnectionCollection.cs
- ClientFormsAuthenticationMembershipProvider.cs
- TextBoxLine.cs
- ProviderSettings.cs
- ImageSourceConverter.cs
- GridToolTip.cs
- Style.cs
- DesignerAttribute.cs
- DtdParser.cs
- DocumentSchemaValidator.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- CorrelationManager.cs
- CodeActivityMetadata.cs
- SamlDelegatingWriter.cs
- ToolStripRendererSwitcher.cs
- TextServicesCompartmentContext.cs
- WhitespaceSignificantCollectionAttribute.cs
- SR.cs
- UrlMappingsSection.cs
- DataViewSettingCollection.cs
- AmbientProperties.cs
- PropertyDescriptorGridEntry.cs
- SoapReflectionImporter.cs
- XmlSchemaValidator.cs
- AuthenticationConfig.cs
- RichTextBoxConstants.cs
- EntitySetBase.cs
- SplitterCancelEvent.cs
- ReliabilityContractAttribute.cs
- ColorConverter.cs
- NavigationExpr.cs
- Glyph.cs
- BufferedReadStream.cs
- TemplateBindingExpression.cs
- BamlLocalizableResourceKey.cs
- InputLangChangeEvent.cs
- TimeoutException.cs
- RouteParser.cs
- DesignerAttribute.cs