Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / WinForms / Managed / System / WinForms / SpecialFolderEnumConverter.cs / 1 / SpecialFolderEnumConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { using System; using System.ComponentModel; using System.Collections; internal class SpecialFolderEnumConverter : AlphaSortedEnumConverter { public SpecialFolderEnumConverter(Type type) : base(type) { } ////// See VSWhidbey #376570. Personal appears twice in type editor because its numeric value matches with MyDocuments. /// This code filters out the duplicate value. public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { StandardValuesCollection values = base.GetStandardValues(context); ArrayList list = new ArrayList(); int count = values.Count; bool personalSeen = false; for (int i = 0; i < count; i++) { if (values[i] is System.Environment.SpecialFolder && values[i].Equals(System.Environment.SpecialFolder.Personal)) { if (!personalSeen) { personalSeen = true; list.Add(values[i]); } } else { list.Add(values[i]); } } return new StandardValuesCollection(list); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { using System; using System.ComponentModel; using System.Collections; internal class SpecialFolderEnumConverter : AlphaSortedEnumConverter { public SpecialFolderEnumConverter(Type type) : base(type) { } ////// See VSWhidbey #376570. Personal appears twice in type editor because its numeric value matches with MyDocuments. /// This code filters out the duplicate value. public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { StandardValuesCollection values = base.GetStandardValues(context); ArrayList list = new ArrayList(); int count = values.Count; bool personalSeen = false; for (int i = 0; i < count; i++) { if (values[i] is System.Environment.SpecialFolder && values[i].Equals(System.Environment.SpecialFolder.Personal)) { if (!personalSeen) { personalSeen = true; list.Add(values[i]); } } else { list.Add(values[i]); } } return new StandardValuesCollection(list); } } } // 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
- ModuleBuilderData.cs
- SpotLight.cs
- ChineseLunisolarCalendar.cs
- StylusCaptureWithinProperty.cs
- Popup.cs
- StaticExtension.cs
- WizardPanelChangingEventArgs.cs
- MachineKeyValidationConverter.cs
- EnumUnknown.cs
- SqlGenerator.cs
- MarkupWriter.cs
- Choices.cs
- SoapSchemaImporter.cs
- WindowsTokenRoleProvider.cs
- HelpEvent.cs
- FlowPosition.cs
- ExpressionBinding.cs
- SafeNativeMethods.cs
- DesignerActionVerbItem.cs
- RelatedImageListAttribute.cs
- UIAgentAsyncParams.cs
- SystemColors.cs
- AdornedElementPlaceholder.cs
- RadioButtonDesigner.cs
- LocatorBase.cs
- SafePipeHandle.cs
- MetricEntry.cs
- MessageQuerySet.cs
- TextParaClient.cs
- InsufficientMemoryException.cs
- GeneralTransform3D.cs
- WebServiceEnumData.cs
- DataGridTablesFactory.cs
- Brush.cs
- AssemblyContextControlItem.cs
- EntityClassGenerator.cs
- ExtenderHelpers.cs
- SqlLiftWhereClauses.cs
- ICspAsymmetricAlgorithm.cs
- TableItemPattern.cs
- SelectedGridItemChangedEvent.cs
- SymbolTable.cs
- X509AsymmetricSecurityKey.cs
- QueryResult.cs
- AvTraceDetails.cs
- CharacterMetrics.cs
- Misc.cs
- DoubleConverter.cs
- Module.cs
- RegisteredArrayDeclaration.cs
- SrgsElementList.cs
- FlowDocument.cs
- TypeSemantics.cs
- Blend.cs
- ExpressionConverter.cs
- SessionStateItemCollection.cs
- ThemeableAttribute.cs
- OdbcError.cs
- TransactionException.cs
- WebPartVerb.cs
- COM2ColorConverter.cs
- QueryStringConverter.cs
- ConnectionManagementElementCollection.cs
- ToolStrip.cs
- TextBoxBase.cs
- LiteralText.cs
- ReturnType.cs
- ItemMap.cs
- MdiWindowListItemConverter.cs
- PageCatalogPart.cs
- LinqDataSourceStatusEventArgs.cs
- FunctionDescription.cs
- VisualTreeUtils.cs
- TrustManagerMoreInformation.cs
- ProcessHostMapPath.cs
- XpsResource.cs
- SharedStatics.cs
- OperationValidationEventArgs.cs
- ILGen.cs
- ContentOnlyMessage.cs
- RadioButton.cs
- BaseComponentEditor.cs
- CellParagraph.cs
- InkCanvasFeedbackAdorner.cs
- BinaryConverter.cs
- CaseInsensitiveHashCodeProvider.cs
- UntypedNullExpression.cs
- _ProxyChain.cs
- Border.cs
- ValidationHelpers.cs
- WmlSelectionListAdapter.cs
- _BasicClient.cs
- VersionedStream.cs
- SecurityUtils.cs
- Logging.cs
- ComponentRenameEvent.cs
- FlowNode.cs
- X509ServiceCertificateAuthentication.cs
- SafeSecurityHelper.cs
- DelegateTypeInfo.cs