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
- EditorZone.cs
- ImageFormat.cs
- SessionPageStateSection.cs
- StrokeIntersection.cs
- XmlSequenceWriter.cs
- EditorServiceContext.cs
- DependentList.cs
- DefaultHttpHandler.cs
- HandlerFactoryCache.cs
- PropertyHelper.cs
- HttpResponseHeader.cs
- GeneralTransform3DTo2DTo3D.cs
- PathSegmentCollection.cs
- AuthStoreRoleProvider.cs
- SchemaCollectionCompiler.cs
- WebPartConnectionCollection.cs
- DocumentOrderQuery.cs
- ActivityBuilderHelper.cs
- XmlHierarchicalDataSourceView.cs
- ConfigXmlReader.cs
- UrlAuthFailureHandler.cs
- XmlSiteMapProvider.cs
- Stack.cs
- HttpGetClientProtocol.cs
- ConfigDefinitionUpdates.cs
- DataGridTablesFactory.cs
- SiteMapPath.cs
- EntityFunctions.cs
- MessageRpc.cs
- ResourcesChangeInfo.cs
- COSERVERINFO.cs
- ProfilePropertyNameValidator.cs
- XmlUtil.cs
- Action.cs
- RoutedEventConverter.cs
- TagPrefixInfo.cs
- InvalidOperationException.cs
- ResourcesBuildProvider.cs
- IOException.cs
- WebPartUserCapability.cs
- ByteAnimationUsingKeyFrames.cs
- CodeAccessSecurityEngine.cs
- Canvas.cs
- Sequence.cs
- CallbackTimeoutsElement.cs
- ClientOptions.cs
- CodeGeneratorOptions.cs
- WindowPatternIdentifiers.cs
- ImageDesigner.cs
- SystemNetHelpers.cs
- InputReferenceExpression.cs
- ApplicationDirectory.cs
- ManifestSignedXml.cs
- GridEntry.cs
- SequentialActivityDesigner.cs
- ColorAnimation.cs
- SafeNativeMethodsMilCoreApi.cs
- DispatchChannelSink.cs
- CodeCatchClauseCollection.cs
- TypeUnloadedException.cs
- BufferBuilder.cs
- SignerInfo.cs
- ConnectionPoolManager.cs
- SHA384.cs
- FixedDocument.cs
- Function.cs
- QilNode.cs
- BamlRecordWriter.cs
- HttpHandlerAction.cs
- ControlParameter.cs
- SecurityPermission.cs
- WebBrowsableAttribute.cs
- SafeRightsManagementHandle.cs
- WebPartCloseVerb.cs
- OdbcPermission.cs
- StickyNoteAnnotations.cs
- QueryOperationResponseOfT.cs
- MapPathBasedVirtualPathProvider.cs
- OperationResponse.cs
- ConstraintStruct.cs
- SimpleType.cs
- CharacterString.cs
- XmlSchemaGroup.cs
- ProgressBarHighlightConverter.cs
- InvokeGenerator.cs
- DockPanel.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- ObjectDataSourceEventArgs.cs
- WindowsSpinner.cs
- BookmarkScopeHandle.cs
- CommonRemoteMemoryBlock.cs
- WebPartCancelEventArgs.cs
- InstanceLockQueryResult.cs
- ObjectListItem.cs
- PageThemeParser.cs
- SqlBooleanMismatchVisitor.cs
- XXXInfos.cs
- EncryptedType.cs
- TypedServiceChannelBuilder.cs
- XAMLParseException.cs