Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / SpecialFolderEnumConverter.cs / 1305376 / 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
- WindowsFont.cs
- QueryOutputWriter.cs
- HtmlShim.cs
- InkPresenter.cs
- regiisutil.cs
- InvokeBinder.cs
- XmlSchemaAnyAttribute.cs
- SecurityTokenInclusionMode.cs
- login.cs
- TextTreeUndo.cs
- DesignerSerializationVisibilityAttribute.cs
- UnSafeCharBuffer.cs
- ConfigurationManagerHelper.cs
- TimeSpanStorage.cs
- DatagridviewDisplayedBandsData.cs
- BitmapEffectInputData.cs
- PropertyGrid.cs
- SafeFileMappingHandle.cs
- RoleService.cs
- CoreSwitches.cs
- Margins.cs
- LongTypeConverter.cs
- MarkupWriter.cs
- hresults.cs
- SimpleRecyclingCache.cs
- ComplexObject.cs
- DriveInfo.cs
- CounterSet.cs
- ValidationSummaryDesigner.cs
- SmiEventSink_Default.cs
- SqlCachedBuffer.cs
- ListBoxChrome.cs
- XdrBuilder.cs
- TextRangeBase.cs
- ShaderEffect.cs
- MetadataItemSerializer.cs
- ColorMatrix.cs
- RoutedEventHandlerInfo.cs
- DataBindingList.cs
- HttpApplication.cs
- PersonalizableTypeEntry.cs
- Instrumentation.cs
- DeploymentExceptionMapper.cs
- HttpCookieCollection.cs
- CqlWriter.cs
- SetUserPreferenceRequest.cs
- InvokeProviderWrapper.cs
- PageVisual.cs
- NoneExcludedImageIndexConverter.cs
- ValidationError.cs
- SubtreeProcessor.cs
- MonikerSyntaxException.cs
- EditorZone.cs
- CDSsyncETWBCLProvider.cs
- Lookup.cs
- VisualStateGroup.cs
- Timer.cs
- dataSvcMapFileLoader.cs
- NamedObject.cs
- BaseInfoTable.cs
- DataSourceUtil.cs
- TrackingProfileSerializer.cs
- HandlerFactoryCache.cs
- LinqDataSourceInsertEventArgs.cs
- TextEffect.cs
- ImportCatalogPart.cs
- AsyncStreamReader.cs
- HeaderLabel.cs
- TableLayoutSettingsTypeConverter.cs
- PrivilegedConfigurationManager.cs
- CharAnimationBase.cs
- SoapIgnoreAttribute.cs
- ObjectDataSourceChooseTypePanel.cs
- CodeSubDirectoriesCollection.cs
- ParserExtension.cs
- EdmEntityTypeAttribute.cs
- LogEntryHeaderv1Deserializer.cs
- FacetDescriptionElement.cs
- Switch.cs
- PageTheme.cs
- Int32Collection.cs
- __FastResourceComparer.cs
- TiffBitmapEncoder.cs
- KeysConverter.cs
- HtmlWindowCollection.cs
- PermissionSetEnumerator.cs
- GridLengthConverter.cs
- ApplicationProxyInternal.cs
- COM2Enum.cs
- XmlCharCheckingWriter.cs
- CodeAccessPermission.cs
- MobileCategoryAttribute.cs
- IncrementalHitTester.cs
- MouseEventArgs.cs
- Command.cs
- ServiceObjectContainer.cs
- BufferedGraphicsManager.cs
- SystemIcmpV6Statistics.cs
- DistinctQueryOperator.cs
- CmsInterop.cs