Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- HttpPostedFile.cs
- Effect.cs
- CellQuery.cs
- TextParaLineResult.cs
- SpnegoTokenProvider.cs
- CompModSwitches.cs
- ApplicationHost.cs
- CommonObjectSecurity.cs
- MultiPartWriter.cs
- GradientBrush.cs
- IxmlLineInfo.cs
- RecordManager.cs
- GeometryDrawing.cs
- Tokenizer.cs
- log.cs
- TypedDataSetSchemaImporterExtensionFx35.cs
- PropertyGeneratedEventArgs.cs
- TypeListConverter.cs
- WebPartUtil.cs
- DynamicUpdateCommand.cs
- PolicyLevel.cs
- ProcessManager.cs
- DataBindingHandlerAttribute.cs
- HashHelper.cs
- DefaultAsyncDataDispatcher.cs
- RegisteredScript.cs
- PeerToPeerException.cs
- CodeParameterDeclarationExpressionCollection.cs
- SmiConnection.cs
- FolderBrowserDialog.cs
- EntityDesignerDataSourceView.cs
- CodeStatement.cs
- FileDialog.cs
- NamespaceInfo.cs
- BinaryParser.cs
- ScriptControl.cs
- CustomErrorCollection.cs
- MetafileHeaderEmf.cs
- COM2ExtendedUITypeEditor.cs
- LogEntrySerializer.cs
- ToolStripDropDownItem.cs
- VisualStyleInformation.cs
- FederatedMessageSecurityOverHttp.cs
- SingleObjectCollection.cs
- DbParameterHelper.cs
- SecurityToken.cs
- PassportAuthentication.cs
- WindowsStatic.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- CapiSymmetricAlgorithm.cs
- ObjectStateFormatter.cs
- OleDbErrorCollection.cs
- basecomparevalidator.cs
- QueryOutputWriter.cs
- ObjectListCommandsPage.cs
- XmlAnyElementAttribute.cs
- FormDesigner.cs
- ContextMarshalException.cs
- KeyValuePairs.cs
- ConfigXmlCDataSection.cs
- RepeaterItem.cs
- AnnotationService.cs
- AppSettings.cs
- OperandQuery.cs
- StatusBarPanelClickEvent.cs
- EntityViewGenerationConstants.cs
- MenuItemAutomationPeer.cs
- DocumentViewerBase.cs
- objectquery_tresulttype.cs
- AssociationEndMember.cs
- DataGridViewCellFormattingEventArgs.cs
- ProtocolElementCollection.cs
- LowerCaseStringConverter.cs
- Preprocessor.cs
- Style.cs
- Verify.cs
- QilScopedVisitor.cs
- HtmlControlPersistable.cs
- CodeTryCatchFinallyStatement.cs
- VisualBrush.cs
- OleDbCommandBuilder.cs
- ToolStripManager.cs
- RelatedView.cs
- MenuAdapter.cs
- DataRowExtensions.cs
- DecoderBestFitFallback.cs
- RemoteWebConfigurationHost.cs
- CompiledQuery.cs
- ProjectedSlot.cs
- DurableRuntimeValidator.cs
- ThrowHelper.cs
- ContextStack.cs
- XamlPathDataSerializer.cs
- TreeViewBindingsEditor.cs
- HopperCache.cs
- OptionalMessageQuery.cs
- XPathNavigatorReader.cs
- SQLStringStorage.cs
- SessionParameter.cs
- BuildProviderAppliesToAttribute.cs