Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Services / Monitoring / system / Diagnosticts / AlphabeticalEnumConverter.cs / 1305376 / AlphabeticalEnumConverter.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Diagnostics {
using System.Collections;
using System.ComponentModel;
using System;
using System.Globalization;
///
///
///
/// Provides a type converter to
/// convert ???? objects to and from various other representations.
///
///
internal class AlphabeticalEnumConverter : EnumConverter {
public AlphabeticalEnumConverter(Type type) : base(type) {
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) {
if (Values == null) {
Array objValues = Enum.GetValues(EnumType);
//IComparer comparer = Comparer;
object[] names = new object[objValues.Length];
for (int i = 0; i < names.Length; i++)
names[i] = ConvertTo(context, null, objValues.GetValue(i), typeof(string));
Array.Sort(names, objValues, 0, objValues.Length, System.Collections.Comparer.Default);
Values = new StandardValuesCollection(objValues);
}
return Values;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Diagnostics {
using System.Collections;
using System.ComponentModel;
using System;
using System.Globalization;
///
///
///
/// Provides a type converter to
/// convert ???? objects to and from various other representations.
///
///
internal class AlphabeticalEnumConverter : EnumConverter {
public AlphabeticalEnumConverter(Type type) : base(type) {
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) {
if (Values == null) {
Array objValues = Enum.GetValues(EnumType);
//IComparer comparer = Comparer;
object[] names = new object[objValues.Length];
for (int i = 0; i < names.Length; i++)
names[i] = ConvertTo(context, null, objValues.GetValue(i), typeof(string));
Array.Sort(names, objValues, 0, objValues.Length, System.Collections.Comparer.Default);
Values = new StandardValuesCollection(objValues);
}
return Values;
}
}
}
// 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
- UserUseLicenseDictionaryLoader.cs
- Currency.cs
- Console.cs
- ToolBar.cs
- RegionData.cs
- CngProperty.cs
- MouseActionConverter.cs
- XmlSchemaComplexContent.cs
- PersonalizationDictionary.cs
- ObjectStateEntry.cs
- MulticastIPAddressInformationCollection.cs
- Window.cs
- Lookup.cs
- PenContexts.cs
- ClientRuntimeConfig.cs
- BooleanFunctions.cs
- EventSinkActivityDesigner.cs
- LineServices.cs
- OracleInfoMessageEventArgs.cs
- CLSCompliantAttribute.cs
- EventPropertyMap.cs
- OracleEncoding.cs
- CommonProperties.cs
- DataGridViewRowCollection.cs
- AssemblyBuilder.cs
- CustomWebEventKey.cs
- CharacterShapingProperties.cs
- SemanticResultKey.cs
- ToolStripMenuItem.cs
- BindableTemplateBuilder.cs
- HtmlMeta.cs
- VectorValueSerializer.cs
- ClassicBorderDecorator.cs
- OuterProxyWrapper.cs
- FileSystemEventArgs.cs
- ToolboxItemFilterAttribute.cs
- WorkflowApplicationTerminatedException.cs
- SqlVisitor.cs
- ElementNotAvailableException.cs
- ListItemsCollectionEditor.cs
- DataGridViewCell.cs
- RightsManagementErrorHandler.cs
- WebPartActionVerb.cs
- GiveFeedbackEvent.cs
- TextTreeExtractElementUndoUnit.cs
- ArrayExtension.cs
- ResolveResponse.cs
- PathTooLongException.cs
- EventLogInternal.cs
- XmlNotation.cs
- AutomationPatternInfo.cs
- Int32Rect.cs
- PrintDocument.cs
- EntityViewContainer.cs
- CoTaskMemHandle.cs
- Boolean.cs
- HyperLinkStyle.cs
- ClickablePoint.cs
- KeyInterop.cs
- CustomErrorsSectionWrapper.cs
- WsdlBuildProvider.cs
- ButtonRenderer.cs
- GenericXmlSecurityToken.cs
- _OverlappedAsyncResult.cs
- PlanCompiler.cs
- EventLogException.cs
- ToolBarOverflowPanel.cs
- ParallelRangeManager.cs
- ZoneLinkButton.cs
- Rectangle.cs
- PackUriHelper.cs
- XmlKeywords.cs
- DataGridViewCellParsingEventArgs.cs
- Message.cs
- DBBindings.cs
- SolidColorBrush.cs
- PeerContact.cs
- OdbcStatementHandle.cs
- DecimalConverter.cs
- TabControl.cs
- CompositeActivityValidator.cs
- XhtmlBasicPhoneCallAdapter.cs
- WorkflowRuntimeElement.cs
- VirtualizingStackPanel.cs
- UnsafeNativeMethods.cs
- ListItem.cs
- InstallerTypeAttribute.cs
- EntityCollectionChangedParams.cs
- GlobalProxySelection.cs
- TreeViewImageGenerator.cs
- KeyedByTypeCollection.cs
- ReadWriteObjectLock.cs
- TextServicesCompartmentEventSink.cs
- QilTargetType.cs
- NullExtension.cs
- TraceLevelStore.cs
- SecurityCriticalDataForSet.cs
- PropertyHelper.cs
- XmlExtensionFunction.cs
- RegexReplacement.cs