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
- ToolStripDropDownMenu.cs
- AsymmetricSignatureDeformatter.cs
- CalloutQueueItem.cs
- AdapterUtil.cs
- BitmapMetadataBlob.cs
- HostProtectionException.cs
- XmlDictionaryWriter.cs
- XmlnsDictionary.cs
- MenuBase.cs
- SyndicationElementExtensionCollection.cs
- VariableBinder.cs
- BinHexDecoder.cs
- InitiatorServiceModelSecurityTokenRequirement.cs
- ControlIdConverter.cs
- SettingsAttributeDictionary.cs
- SecureStringHasher.cs
- TCPListener.cs
- BodyGlyph.cs
- DataSourceControlBuilder.cs
- CodeMethodReturnStatement.cs
- Size3D.cs
- FutureFactory.cs
- PreviewKeyDownEventArgs.cs
- ScrollPatternIdentifiers.cs
- HttpListenerElement.cs
- DispatcherExceptionFilterEventArgs.cs
- BitmapEffectvisualstate.cs
- BitVec.cs
- HtmlTable.cs
- ReferencedType.cs
- ZipIOLocalFileBlock.cs
- GradientStop.cs
- RepeaterDesigner.cs
- MarkupWriter.cs
- CompilerInfo.cs
- Maps.cs
- Italic.cs
- DiffuseMaterial.cs
- AdCreatedEventArgs.cs
- BackgroundFormatInfo.cs
- BindingCollection.cs
- ActiveXMessageFormatter.cs
- InheritedPropertyChangedEventArgs.cs
- TCPListener.cs
- dtdvalidator.cs
- CalendarButtonAutomationPeer.cs
- XmlSchemaImporter.cs
- TextWriterTraceListener.cs
- CacheAxisQuery.cs
- InputScopeNameConverter.cs
- GridViewItemAutomationPeer.cs
- BulletedList.cs
- CancellationState.cs
- CompModSwitches.cs
- AuthenticationModuleElementCollection.cs
- BmpBitmapEncoder.cs
- SoundPlayer.cs
- PhysicalOps.cs
- DataList.cs
- TypeGeneratedEventArgs.cs
- XmlILOptimizerVisitor.cs
- ConnectionPoolManager.cs
- SByteStorage.cs
- WebBrowser.cs
- ReadOnlyPropertyMetadata.cs
- ScrollBar.cs
- GC.cs
- ChtmlTextWriter.cs
- MultiAsyncResult.cs
- CollectionType.cs
- MarshalDirectiveException.cs
- PreviewPageInfo.cs
- DbDataReader.cs
- CultureMapper.cs
- ReadOnlyAttribute.cs
- ThreadInterruptedException.cs
- AnonymousIdentificationModule.cs
- BrowserCapabilitiesFactoryBase.cs
- ExpressionBuilder.cs
- TextTreeFixupNode.cs
- ErrorWebPart.cs
- Misc.cs
- KeyboardNavigation.cs
- ProgressBarHighlightConverter.cs
- ListBindingHelper.cs
- basenumberconverter.cs
- FontUnit.cs
- ContentOperations.cs
- OleDbConnectionFactory.cs
- HtmlContainerControl.cs
- Int32CollectionValueSerializer.cs
- safelinkcollection.cs
- NumericPagerField.cs
- DebugView.cs
- ActivityExecutionContextCollection.cs
- DefinitionUpdate.cs
- Exceptions.cs
- SliderAutomationPeer.cs
- NegatedCellConstant.cs
- GreenMethods.cs