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
- CustomWebEventKey.cs
- ProtectedConfiguration.cs
- ISFClipboardData.cs
- DES.cs
- XmlCharType.cs
- ToolboxComponentsCreatingEventArgs.cs
- WithStatement.cs
- VisualBrush.cs
- RadioButtonList.cs
- ConfigurationValue.cs
- FileRecordSequenceHelper.cs
- RankException.cs
- LongTypeConverter.cs
- CompModSwitches.cs
- WindowsListViewSubItem.cs
- DataViewManager.cs
- SqlConnection.cs
- LogicalExpr.cs
- CommunicationObjectFaultedException.cs
- CommandCollectionEditor.cs
- BufferModesCollection.cs
- UrlMapping.cs
- BitmapEffectInput.cs
- SimpleTextLine.cs
- MetafileEditor.cs
- SqlCachedBuffer.cs
- ProxyManager.cs
- TreeChangeInfo.cs
- SoapSchemaMember.cs
- StateDesigner.CommentLayoutGlyph.cs
- LoadRetryConstantStrategy.cs
- GenericEnumerator.cs
- HotCommands.cs
- ControlAdapter.cs
- CancellationHandlerDesigner.cs
- WinFormsSpinner.cs
- Ray3DHitTestResult.cs
- ColorAnimationBase.cs
- IncrementalReadDecoders.cs
- RelatedImageListAttribute.cs
- SqlOuterApplyReducer.cs
- FormViewInsertedEventArgs.cs
- InputReport.cs
- SQLMembershipProvider.cs
- XmlDocumentType.cs
- SamlAuthenticationStatement.cs
- ContainerTracking.cs
- SafeEventLogWriteHandle.cs
- ReferenceService.cs
- DebugView.cs
- InstanceData.cs
- DBConnectionString.cs
- MonthCalendar.cs
- CodeDirectoryCompiler.cs
- BooleanSwitch.cs
- PeerName.cs
- RoleExceptions.cs
- TextTreeTextElementNode.cs
- DocumentXPathNavigator.cs
- NodeLabelEditEvent.cs
- safesecurityhelperavalon.cs
- ServiceInstanceProvider.cs
- ServiceHostFactory.cs
- SystemEvents.cs
- TaskDesigner.cs
- FormViewModeEventArgs.cs
- PageParserFilter.cs
- Floater.cs
- ByteStream.cs
- NameValueConfigurationCollection.cs
- MouseGesture.cs
- Knowncolors.cs
- HttpBufferlessInputStream.cs
- Converter.cs
- TraceInternal.cs
- EventlogProvider.cs
- PatternMatchRules.cs
- MaskedTextProvider.cs
- Point3DValueSerializer.cs
- SelectedCellsCollection.cs
- SamlAdvice.cs
- MainMenu.cs
- TransformerInfo.cs
- NativeWrapper.cs
- MetadataArtifactLoaderCompositeFile.cs
- AppSettingsReader.cs
- OdbcTransaction.cs
- FrameDimension.cs
- PropertyConverter.cs
- PagedControl.cs
- FontUnit.cs
- EventMappingSettingsCollection.cs
- EditBehavior.cs
- OrderedParallelQuery.cs
- SweepDirectionValidation.cs
- EntityCommandDefinition.cs
- XsltOutput.cs
- AddingNewEventArgs.cs
- SqlDataSourceSummaryPanel.cs
- ResourceExpressionBuilder.cs