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
- DesignerActionHeaderItem.cs
- FormatException.cs
- XmlSchemaImporter.cs
- HtmlDocument.cs
- EditingMode.cs
- ThrowOnMultipleAssignment.cs
- XmlCharacterData.cs
- ValidationUtility.cs
- _LocalDataStore.cs
- HyperLinkField.cs
- FileDetails.cs
- HasCopySemanticsAttribute.cs
- CopyOfAction.cs
- GlyphTypeface.cs
- ExclusiveCanonicalizationTransform.cs
- TargetParameterCountException.cs
- ApplicationProxyInternal.cs
- StateItem.cs
- DiscoveryVersionConverter.cs
- mansign.cs
- QilCloneVisitor.cs
- InternalResources.cs
- FrameworkElement.cs
- Completion.cs
- ThreadExceptionDialog.cs
- CompiledQueryCacheKey.cs
- Point3DAnimationUsingKeyFrames.cs
- Publisher.cs
- ObservableCollection.cs
- ProfilePropertySettings.cs
- VectorAnimationUsingKeyFrames.cs
- DrawItemEvent.cs
- ThreadSafeList.cs
- UTF8Encoding.cs
- _SSPISessionCache.cs
- DocComment.cs
- LogRestartAreaEnumerator.cs
- ConvertersCollection.cs
- ByteStorage.cs
- MethodSet.cs
- RegexRunnerFactory.cs
- DirectoryObjectSecurity.cs
- JsonUriDataContract.cs
- SoapFormatter.cs
- IndicCharClassifier.cs
- bindurihelper.cs
- DataGridViewCellStyleConverter.cs
- WebResponse.cs
- StackSpiller.Generated.cs
- AnnotationComponentManager.cs
- entityreference_tresulttype.cs
- UnionCodeGroup.cs
- MessageVersion.cs
- HttpDictionary.cs
- HttpListenerContext.cs
- CriticalHandle.cs
- OperandQuery.cs
- IntSecurity.cs
- WebControl.cs
- httpserverutility.cs
- StrokeNodeData.cs
- HtmlInputPassword.cs
- WindowsSecurityToken.cs
- ButtonFieldBase.cs
- UIElementAutomationPeer.cs
- CustomErrorsSection.cs
- IsolatedStorage.cs
- EventsTab.cs
- RayMeshGeometry3DHitTestResult.cs
- XmlSchemaValidationException.cs
- WindowsContainer.cs
- DnsPermission.cs
- PrinterSettings.cs
- NCryptNative.cs
- HandlerFactoryCache.cs
- InstancePersistence.cs
- SettingsPropertyCollection.cs
- QilCloneVisitor.cs
- BinaryCommonClasses.cs
- Mapping.cs
- XamlContextStack.cs
- MethodImplAttribute.cs
- PropertyManager.cs
- InvokeMethodActivityDesigner.cs
- TextServicesHost.cs
- SqlCachedBuffer.cs
- GlyphCollection.cs
- SqlNodeAnnotation.cs
- RightsManagementEncryptionTransform.cs
- Debugger.cs
- QuarticEase.cs
- ToolStripOverflowButton.cs
- RightsManagementEncryptionTransform.cs
- CustomAssemblyResolver.cs
- DiffuseMaterial.cs
- KerberosTicketHashIdentifierClause.cs
- StylusCaptureWithinProperty.cs
- XmlSchemaAttributeGroupRef.cs
- DataGridViewButtonCell.cs
- MouseButton.cs