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
- EntitySetBaseCollection.cs
- listitem.cs
- WinEventWrap.cs
- TreeNodeMouseHoverEvent.cs
- MachineSettingsSection.cs
- GridProviderWrapper.cs
- EnumType.cs
- CallbackTimeoutsElement.cs
- TypeConverterAttribute.cs
- MenuItem.cs
- DiscreteKeyFrames.cs
- DesigntimeLicenseContextSerializer.cs
- ColorTranslator.cs
- UntypedNullExpression.cs
- StringToken.cs
- SHA1CryptoServiceProvider.cs
- ReferenceAssemblyAttribute.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- SubpageParagraph.cs
- BaseCodeDomTreeGenerator.cs
- ColumnPropertiesGroup.cs
- Graphics.cs
- RepeatButtonAutomationPeer.cs
- ThemeInfoAttribute.cs
- ControlCodeDomSerializer.cs
- ErrorFormatter.cs
- DefaultProxySection.cs
- XmlName.cs
- ToolStripItemCollection.cs
- OutputCacheProfile.cs
- DocumentViewerConstants.cs
- RepeatButtonAutomationPeer.cs
- ItemType.cs
- ListControl.cs
- _Rfc2616CacheValidators.cs
- GACIdentityPermission.cs
- DispatchWrapper.cs
- ArrayWithOffset.cs
- ObjectQueryExecutionPlan.cs
- NamespaceTable.cs
- UnsafeNativeMethods.cs
- MultiDataTrigger.cs
- HtmlTable.cs
- ProcessHostServerConfig.cs
- IISUnsafeMethods.cs
- ValidationRuleCollection.cs
- TypeContext.cs
- GlyphRunDrawing.cs
- Int16Converter.cs
- NonBatchDirectoryCompiler.cs
- SafeThreadHandle.cs
- _SSPIWrapper.cs
- ButtonPopupAdapter.cs
- BamlLocalizableResource.cs
- PaperSize.cs
- NetNamedPipeSecurityMode.cs
- IQueryable.cs
- TabRenderer.cs
- DPCustomTypeDescriptor.cs
- ProtectedProviderSettings.cs
- TextRangeBase.cs
- NetPeerTcpBinding.cs
- ScopeCompiler.cs
- SqlConnectionStringBuilder.cs
- TablePattern.cs
- ManagementEventWatcher.cs
- TextBox.cs
- FontStretchConverter.cs
- RuntimeUtils.cs
- ProfileSettings.cs
- SecurityUtils.cs
- StackBuilderSink.cs
- MinimizableAttributeTypeConverter.cs
- GPPOINTF.cs
- WebSysDisplayNameAttribute.cs
- EmptyTextWriter.cs
- Annotation.cs
- PersonalizationStateInfoCollection.cs
- XmlBaseWriter.cs
- WebPartVerb.cs
- BamlTreeUpdater.cs
- ValueType.cs
- IndependentAnimationStorage.cs
- TcpClientSocketManager.cs
- AttributeParameterInfo.cs
- Debug.cs
- RecipientInfo.cs
- BindingContext.cs
- SafeSecurityHelper.cs
- DecoderExceptionFallback.cs
- LinkClickEvent.cs
- ProcessManager.cs
- PrimarySelectionGlyph.cs
- TransportElement.cs
- _NegotiateClient.cs
- ApplicationDirectory.cs
- ActionFrame.cs
- ISCIIEncoding.cs
- DirectoryInfo.cs
- LocalClientSecuritySettingsElement.cs