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
- PointLight.cs
- QilLiteral.cs
- StrongBox.cs
- MetadataUtilsSmi.cs
- UriExt.cs
- CertificateManager.cs
- PersonalizationProviderCollection.cs
- PartitionerStatic.cs
- AdRotator.cs
- SqlCaseSimplifier.cs
- DecoderFallback.cs
- XmlSchemaSet.cs
- DocumentApplicationJournalEntry.cs
- ProfileGroupSettings.cs
- DataTable.cs
- IndentedTextWriter.cs
- WebExceptionStatus.cs
- ClientSettings.cs
- ProofTokenCryptoHandle.cs
- ConnectionStringsSection.cs
- RegisteredArrayDeclaration.cs
- EasingKeyFrames.cs
- TableStyle.cs
- DatatypeImplementation.cs
- ContentValidator.cs
- WindowsSlider.cs
- Models.cs
- FixedSOMFixedBlock.cs
- DurationConverter.cs
- DataGridPageChangedEventArgs.cs
- xmlglyphRunInfo.cs
- Rfc4050KeyFormatter.cs
- UnicodeEncoding.cs
- LocalizableAttribute.cs
- ClientSession.cs
- SiteMapSection.cs
- SynchronizedPool.cs
- ApplicationServiceHelper.cs
- SQLUtility.cs
- columnmapkeybuilder.cs
- CrossContextChannel.cs
- ActiveXContainer.cs
- HostingPreferredMapPath.cs
- GiveFeedbackEventArgs.cs
- EventRoute.cs
- ExpressionStringBuilder.cs
- DetailsViewUpdateEventArgs.cs
- BitFlagsGenerator.cs
- ScriptControl.cs
- LayoutEditorPart.cs
- CoTaskMemHandle.cs
- PrinterSettings.cs
- CultureTable.cs
- SortExpressionBuilder.cs
- TableLayoutColumnStyleCollection.cs
- ClientUtils.cs
- PageCodeDomTreeGenerator.cs
- CodeCompileUnit.cs
- PermissionToken.cs
- GeometryConverter.cs
- Quaternion.cs
- serverconfig.cs
- PaintValueEventArgs.cs
- ItemChangedEventArgs.cs
- FormsAuthenticationTicket.cs
- XmlSchemaDocumentation.cs
- mediaclock.cs
- DesignerActionListCollection.cs
- SQLInt64.cs
- InvalidPrinterException.cs
- RecordBuilder.cs
- WizardPanel.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- ColumnResult.cs
- MsmqReceiveParameters.cs
- ContentValidator.cs
- NameSpaceExtractor.cs
- ExecutedRoutedEventArgs.cs
- XmlSchemaSet.cs
- TextServicesManager.cs
- LockedAssemblyCache.cs
- BooleanFacetDescriptionElement.cs
- DefaultParameterValueAttribute.cs
- DataRecordInfo.cs
- SBCSCodePageEncoding.cs
- MethodAccessException.cs
- EntityUtil.cs
- XmlILAnnotation.cs
- TextBoxAutoCompleteSourceConverter.cs
- MethodAccessException.cs
- VirtualizedContainerService.cs
- MetadataUtilsSmi.cs
- StylusPointPropertyId.cs
- RequestResponse.cs
- StreamAsIStream.cs
- LineMetrics.cs
- DbConnectionStringBuilder.cs
- EntryPointNotFoundException.cs
- XamlTypeMapperSchemaContext.cs
- TripleDESCryptoServiceProvider.cs