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
- Image.cs
- AutoResizedEvent.cs
- WizardPanelChangingEventArgs.cs
- StateMachineWorkflowInstance.cs
- MultipartIdentifier.cs
- SimpleNameService.cs
- CheckBoxBaseAdapter.cs
- ProvidePropertyAttribute.cs
- Rotation3DAnimationBase.cs
- MessageBox.cs
- ContextMarshalException.cs
- GlobalEventManager.cs
- StylusPointPropertyInfoDefaults.cs
- Ipv6Element.cs
- SiteMapNode.cs
- ForeignKeyConstraint.cs
- PersonalizationAdministration.cs
- SmtpNegotiateAuthenticationModule.cs
- ImageMapEventArgs.cs
- PropertyEntry.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- SimpleWorkerRequest.cs
- OracleInfoMessageEventArgs.cs
- BinHexDecoder.cs
- TaskFileService.cs
- EventDescriptor.cs
- XmlTypeMapping.cs
- ImageField.cs
- TransactionManager.cs
- BitmapEffectvisualstate.cs
- OnOperation.cs
- ColorConvertedBitmap.cs
- SafeHandle.cs
- COM2ComponentEditor.cs
- StringAttributeCollection.cs
- QuaternionRotation3D.cs
- HtmlElementEventArgs.cs
- SchemaCollectionPreprocessor.cs
- TreeNodeSelectionProcessor.cs
- AutomationPattern.cs
- DrawingDrawingContext.cs
- _SSPISessionCache.cs
- LayoutManager.cs
- ContentValidator.cs
- FlowchartDesigner.Helpers.cs
- DesignerLoader.cs
- InsufficientMemoryException.cs
- StateMachine.cs
- ObjectDisposedException.cs
- MessagePartDescription.cs
- FolderNameEditor.cs
- WebBrowserPermission.cs
- DeferrableContentConverter.cs
- _CacheStreams.cs
- UrlPropertyAttribute.cs
- DefaultExpressionVisitor.cs
- SoapMessage.cs
- BindingCollection.cs
- StringFreezingAttribute.cs
- JournalEntryListConverter.cs
- PolyLineSegmentFigureLogic.cs
- GlyphTypeface.cs
- WebPartConnectionsConnectVerb.cs
- WebConvert.cs
- OleDbTransaction.cs
- Debug.cs
- SqlTypesSchemaImporter.cs
- State.cs
- SqlVersion.cs
- OLEDB_Enum.cs
- HuffModule.cs
- ScriptDescriptor.cs
- DecoderFallback.cs
- Point3DAnimation.cs
- SqlMethodAttribute.cs
- HtmlInputPassword.cs
- wgx_sdk_version.cs
- InternalSafeNativeMethods.cs
- SamlAudienceRestrictionCondition.cs
- ObjectReaderCompiler.cs
- XmlDownloadManager.cs
- GenericTextProperties.cs
- ApplicationInterop.cs
- BaseAsyncResult.cs
- TemplateParser.cs
- Registry.cs
- Mapping.cs
- CatalogZoneBase.cs
- Misc.cs
- ADConnectionHelper.cs
- RequestCachingSection.cs
- SchemaObjectWriter.cs
- tooltip.cs
- SyndicationDeserializer.cs
- EntityContainer.cs
- DomNameTable.cs
- DataGridViewCellCancelEventArgs.cs
- ExceptionAggregator.cs
- XmlNodeReader.cs
- AttributeEmitter.cs