Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Services / Monitoring / system / Diagnosticts / AlphabeticalEnumConverter.cs / 1 / 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
- GetKeyedHashRequest.cs
- ListViewItemSelectionChangedEvent.cs
- _Events.cs
- BitSet.cs
- HttpRequestTraceRecord.cs
- OleDbCommand.cs
- DataListItemCollection.cs
- tooltip.cs
- ComplexBindingPropertiesAttribute.cs
- RenderDataDrawingContext.cs
- ObjectDataSourceSelectingEventArgs.cs
- XmlSchemaSimpleType.cs
- ComponentManagerBroker.cs
- MessageDescriptionCollection.cs
- NameValueFileSectionHandler.cs
- ConditionalAttribute.cs
- IRCollection.cs
- MediaEntryAttribute.cs
- PackageFilter.cs
- AmbientValueAttribute.cs
- ConfigurationFileMap.cs
- ClaimTypes.cs
- SerializationFieldInfo.cs
- SqlProcedureAttribute.cs
- XmlSerializationWriter.cs
- BuildProvider.cs
- PerformanceCounterCategory.cs
- SchemaCollectionCompiler.cs
- Accessible.cs
- PagedDataSource.cs
- DoubleAnimationClockResource.cs
- CompilationUtil.cs
- _KerberosClient.cs
- SplayTreeNode.cs
- MessagePropertyVariants.cs
- TextOnlyOutput.cs
- LogEntrySerializationException.cs
- SqlErrorCollection.cs
- NavigationService.cs
- FormClosingEvent.cs
- TemplatePagerField.cs
- SystemIPInterfaceStatistics.cs
- ObservableCollection.cs
- GeneralTransform3DTo2D.cs
- CharacterMetrics.cs
- FloatMinMaxAggregationOperator.cs
- HttpCookieCollection.cs
- ReadContentAsBinaryHelper.cs
- StringCollectionEditor.cs
- WebPartCatalogAddVerb.cs
- DataGridViewComboBoxColumn.cs
- WebRequestModulesSection.cs
- SqlDataRecord.cs
- XmlStrings.cs
- DataGridViewElement.cs
- SqlDataSourceConnectionPanel.cs
- DocumentGridContextMenu.cs
- Hash.cs
- RoutedUICommand.cs
- WorkflowRuntimeServiceElement.cs
- ViewBase.cs
- VariableQuery.cs
- Positioning.cs
- InvalidCommandTreeException.cs
- Encoder.cs
- HostProtectionPermission.cs
- LinqDataSourceStatusEventArgs.cs
- DataRelationPropertyDescriptor.cs
- BitmapEffectOutputConnector.cs
- BitmapFrame.cs
- WpfWebRequestHelper.cs
- WebAdminConfigurationHelper.cs
- Point3DKeyFrameCollection.cs
- UiaCoreProviderApi.cs
- ValuePatternIdentifiers.cs
- GenericWebPart.cs
- SystemPens.cs
- ObjectParameter.cs
- WebServiceHandler.cs
- PersonalizationProviderHelper.cs
- Unit.cs
- DataViewSettingCollection.cs
- Schema.cs
- UIElementPropertyUndoUnit.cs
- UserControlBuildProvider.cs
- WindowsImpersonationContext.cs
- InternalReceiveMessage.cs
- InvokePatternIdentifiers.cs
- DropSource.cs
- ImpersonationContext.cs
- ListItemCollection.cs
- DocumentViewerHelper.cs
- PerformanceCounterCategory.cs
- BuildProvider.cs
- CodeMethodInvokeExpression.cs
- RTLAwareMessageBox.cs
- Hex.cs
- PageWrapper.cs
- DetailsViewAutoFormat.cs
- DataSourceProvider.cs