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
- Int32Collection.cs
- SecurityTokenSerializer.cs
- FormattedTextSymbols.cs
- MenuCommand.cs
- TextModifierScope.cs
- Screen.cs
- AsyncCompletedEventArgs.cs
- SQLDateTime.cs
- HtmlAnchor.cs
- SponsorHelper.cs
- TableChangeProcessor.cs
- TokenizerHelper.cs
- TheQuery.cs
- RecognizedAudio.cs
- METAHEADER.cs
- StylusEventArgs.cs
- mda.cs
- DoubleAnimationUsingKeyFrames.cs
- RC2CryptoServiceProvider.cs
- WorkflowNamespace.cs
- TypeListConverter.cs
- ManagementEventArgs.cs
- BasicHttpBindingCollectionElement.cs
- RoutedEvent.cs
- MenuAdapter.cs
- WebPartConnectionsEventArgs.cs
- FormatConvertedBitmap.cs
- LongValidator.cs
- Symbol.cs
- XmlNullResolver.cs
- CustomErrorCollection.cs
- RotateTransform3D.cs
- Internal.cs
- SplineQuaternionKeyFrame.cs
- ServiceEndpointElementCollection.cs
- HtmlToClrEventProxy.cs
- StateFinalizationDesigner.cs
- TextRange.cs
- SchemaTableOptionalColumn.cs
- TypeResolvingOptionsAttribute.cs
- MenuItem.cs
- RequestTimeoutManager.cs
- TcpHostedTransportConfiguration.cs
- ResourceDictionary.cs
- DetailsViewDeletedEventArgs.cs
- XhtmlConformanceSection.cs
- TrackBarRenderer.cs
- XsltSettings.cs
- StaticTextPointer.cs
- XmlDocumentFieldSchema.cs
- ToolboxDataAttribute.cs
- Rotation3D.cs
- AssociationSetEnd.cs
- OuterGlowBitmapEffect.cs
- PartialList.cs
- ContentOperations.cs
- BufferModeSettings.cs
- UnsafeNativeMethodsTablet.cs
- MailWebEventProvider.cs
- UniqueCodeIdentifierScope.cs
- GPStream.cs
- PtsHost.cs
- DesignerVerbCollection.cs
- DispatcherProcessingDisabled.cs
- Descriptor.cs
- OrthographicCamera.cs
- SQLDouble.cs
- OperationPickerDialog.designer.cs
- XmlQuerySequence.cs
- CompareValidator.cs
- PerformanceCounterPermissionEntry.cs
- BufferedResponseStream.cs
- Overlapped.cs
- TabControl.cs
- RijndaelManaged.cs
- SoapCodeExporter.cs
- DataTable.cs
- MonthChangedEventArgs.cs
- Size.cs
- MdiWindowListStrip.cs
- WSHttpBindingBaseElement.cs
- TextSelectionProcessor.cs
- ADMembershipProvider.cs
- SecurityPermission.cs
- WindowsImpersonationContext.cs
- KeySplineConverter.cs
- HtmlInputHidden.cs
- DataGridPageChangedEventArgs.cs
- HtmlInputHidden.cs
- FrameAutomationPeer.cs
- FileChangeNotifier.cs
- ObjectCloneHelper.cs
- _ListenerRequestStream.cs
- WebServiceErrorEvent.cs
- designeractionbehavior.cs
- InfoCardKeyedHashAlgorithm.cs
- PageAdapter.cs
- EnumConverter.cs
- configsystem.cs
- LayoutManager.cs