Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Configuration / RuleInfoComparer.cs / 1305376 / RuleInfoComparer.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.Globalization; using System.IO; using System.Text; using System.ComponentModel; using System.Web.Hosting; using System.Web.Util; using System.Web.Configuration; using System.Web.Management; using System.Web.Compilation; // // This class is used to compare two RuleInfo object. Basically, the array list // will be sorted based on class hierachical order. The smaller the value, the // more nearer the class is to the root (WebBaseEvent), in a class inheritance sense. // // On the other hand, if x > y, it means x is NOT a parent class of y. // // The array is sorted in this way so that if we want to find out the config setting of // an event class x, we start searching in a decreasing order, and the first entry (E) // that satifies the test: if (x is E), then we find the right settings for x. // // BTW, this is just a trick to save me from writing too much code. A n-node tree // method is faster, but I was too lazy. // internal class RuleInfoComparer : IComparer{ public int Compare(object x, object y) { int res; Type xType = ((HealthMonitoringSectionHelper.RuleInfo)x)._eventMappingSettings.RealType; Type yType = ((HealthMonitoringSectionHelper.RuleInfo)y)._eventMappingSettings.RealType; if (xType.Equals(yType)) { res = 0; } else if (xType.IsSubclassOf(yType)) { res = 1; } else if (yType.IsSubclassOf(xType)) { res = -1; } else { // If they're unrelated, we can't return 0 because it // will confuse the sorting method. // We can return 1 or -1, but it must be consistent. return String.Compare(xType.ToString(), yType.ToString(), StringComparison.Ordinal); } Debug.Trace("RuleInfoComparer", "xType=" + xType.ToString() + "; yType=" + yType.ToString() + "; res=" + res); return res; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ResXDataNode.cs
- WindowsComboBox.cs
- tooltip.cs
- SortedList.cs
- ImageList.cs
- MediaElementAutomationPeer.cs
- DoubleAnimationBase.cs
- TextEndOfLine.cs
- RenderingBiasValidation.cs
- BrushValueSerializer.cs
- EntityContainer.cs
- ScrollViewerAutomationPeer.cs
- Rotation3DAnimationBase.cs
- SByteConverter.cs
- ExpressionList.cs
- MouseGestureConverter.cs
- TypeUtils.cs
- WinCategoryAttribute.cs
- HtmlTableRow.cs
- CombinedGeometry.cs
- ScrollBarAutomationPeer.cs
- ObjectSet.cs
- TypeProvider.cs
- IIS7UserPrincipal.cs
- Vector3DKeyFrameCollection.cs
- SafeLibraryHandle.cs
- AuthenticateEventArgs.cs
- CodeExporter.cs
- ErrorFormatterPage.cs
- StructuralCache.cs
- UpDownEvent.cs
- Point3DAnimationUsingKeyFrames.cs
- ObjectNavigationPropertyMapping.cs
- TypeListConverter.cs
- PtsContext.cs
- _ConnectStream.cs
- ThreadWorkerController.cs
- ClientType.cs
- SqlNotificationEventArgs.cs
- FactoryGenerator.cs
- OracleBoolean.cs
- DependencyObjectProvider.cs
- IconConverter.cs
- SimpleHandlerBuildProvider.cs
- PcmConverter.cs
- CfgRule.cs
- RegistryDataKey.cs
- VerificationException.cs
- FocusTracker.cs
- CollectionChangeEventArgs.cs
- SqlVersion.cs
- MetadataItemEmitter.cs
- _ShellExpression.cs
- WorkItem.cs
- Rect3DConverter.cs
- FreezableDefaultValueFactory.cs
- ExpressionConverter.cs
- WorkflowDesignerColors.cs
- InfiniteIntConverter.cs
- SByteStorage.cs
- Events.cs
- WebBrowserPermission.cs
- RegexStringValidatorAttribute.cs
- BinaryMessageEncodingBindingElement.cs
- PackagePart.cs
- HtmlControlPersistable.cs
- CellLabel.cs
- PublishLicense.cs
- XmlSchemaParticle.cs
- WebBrowserHelper.cs
- CancellableEnumerable.cs
- ProviderConnectionPointCollection.cs
- EventMappingSettings.cs
- ImageFormat.cs
- CodeAttachEventStatement.cs
- ResXResourceWriter.cs
- namescope.cs
- MethodSet.cs
- RefreshPropertiesAttribute.cs
- ToolStripRenderer.cs
- XmlBindingWorker.cs
- AsyncPostBackErrorEventArgs.cs
- Table.cs
- Debug.cs
- StrongNameUtility.cs
- EvidenceTypeDescriptor.cs
- MultiTrigger.cs
- InstancePersistence.cs
- Encoder.cs
- CodeNamespace.cs
- SqlDataSourceRefreshSchemaForm.cs
- StdValidatorsAndConverters.cs
- ProgressiveCrcCalculatingStream.cs
- PtsPage.cs
- LicFileLicenseProvider.cs
- IMembershipProvider.cs
- SimpleMailWebEventProvider.cs
- DivideByZeroException.cs
- SByte.cs
- _ConnectOverlappedAsyncResult.cs