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
- ImmutableObjectAttribute.cs
- CompilerState.cs
- PeerApplication.cs
- ProcessHostServerConfig.cs
- DLinqDataModelProvider.cs
- ObjectSecurity.cs
- BoolExpr.cs
- CodeArrayCreateExpression.cs
- BinaryMessageFormatter.cs
- QilParameter.cs
- OrderedDictionary.cs
- SoapExtensionStream.cs
- DelegateTypeInfo.cs
- XmlWrappingWriter.cs
- WorkflowViewManager.cs
- ITextView.cs
- VirtualPathUtility.cs
- UriExt.cs
- RenderTargetBitmap.cs
- CodeTypeMemberCollection.cs
- NotCondition.cs
- TextAction.cs
- TextTreeTextNode.cs
- MaskedTextBoxDesignerActionList.cs
- XmlSchemaSimpleType.cs
- BypassElementCollection.cs
- ExpressionsCollectionEditor.cs
- FlagsAttribute.cs
- MILUtilities.cs
- QueryExpr.cs
- RangeValuePattern.cs
- WebControlAdapter.cs
- CustomAttributeBuilder.cs
- TableChangeProcessor.cs
- ProvidePropertyAttribute.cs
- ComponentCodeDomSerializer.cs
- JournalEntryListConverter.cs
- ConfigXmlElement.cs
- BindingSource.cs
- UseLicense.cs
- NotifyCollectionChangedEventArgs.cs
- ResourceFallbackManager.cs
- KeyInstance.cs
- InternalControlCollection.cs
- CfgParser.cs
- XmlSchemaAnyAttribute.cs
- LabelEditEvent.cs
- Message.cs
- PersonalizationDictionary.cs
- NotSupportedException.cs
- RegexRunner.cs
- LogEntryDeserializer.cs
- ControlIdConverter.cs
- PointLightBase.cs
- LoggedException.cs
- Menu.cs
- DocumentViewer.cs
- EntityReference.cs
- FlowStep.cs
- GlyphInfoList.cs
- LZCodec.cs
- ControlValuePropertyAttribute.cs
- Sequence.cs
- NetNamedPipeSecurityMode.cs
- CacheForPrimitiveTypes.cs
- EntitySet.cs
- ACL.cs
- SQLByte.cs
- EdmItemError.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- Int32KeyFrameCollection.cs
- IisHelper.cs
- ValidationSummary.cs
- NotifyParentPropertyAttribute.cs
- GeneralTransform2DTo3D.cs
- CodeCatchClause.cs
- UnsupportedPolicyOptionsException.cs
- Win32SafeHandles.cs
- Model3D.cs
- TextBox.cs
- AccessControlList.cs
- ParallelTimeline.cs
- HttpRawResponse.cs
- WebServicesSection.cs
- RoutedEventConverter.cs
- TCPListener.cs
- DataGridViewTextBoxEditingControl.cs
- PropertyDescriptor.cs
- Contracts.cs
- CorruptingExceptionCommon.cs
- ContentType.cs
- ReferenceEqualityComparer.cs
- WebServiceMethodData.cs
- ClockGroup.cs
- MethodImplAttribute.cs
- ClientConfigurationHost.cs
- BaseTemplateCodeDomTreeGenerator.cs
- LayoutInformation.cs
- NegotiateStream.cs
- Rect3D.cs