Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / StringArrayEditor.cs / 1 / StringArrayEditor.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Windows.Forms.Design { using System; using System.Collections; using Microsoft.Win32; using System.ComponentModel; using System.ComponentModel.Design; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Drawing; using System.Windows.Forms; ////// /// The StringArrayEditor is a collection editor that is specifically /// designed to edit arrays containing strings. /// internal class StringArrayEditor : StringCollectionEditor { [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] public StringArrayEditor(Type type) : base(type) { } ////// /// Retrieves the data type this collection contains. The default /// implementation looks inside of the collection for the Item property /// and returns the returning datatype of the item. Do not call this /// method directly. Instead, use the CollectionItemType property. Use this /// method to override the default implementation. /// protected override Type CreateCollectionItemType() { return CollectionType.GetElementType(); } ////// /// We implement the getting and setting of items on this collection. /// protected override object[] GetItems(object editValue) { Array valueArray = editValue as Array; if (valueArray == null) { return new object[0]; } else { object[] items = new object[valueArray.GetLength(0)]; Array.Copy(valueArray, items, items.Length); return items; } } ////// /// We implement the getting and setting of items on this collection. /// It should return an instance to replace editValue with, or editValue /// if there is no need to replace the instance. /// protected override object SetItems(object editValue, object[] value) { if (editValue is Array || editValue == null) { Array newArray = Array.CreateInstance(CollectionItemType, value.Length); Array.Copy(value, newArray, value.Length); return newArray; } return editValue; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MenuItemStyle.cs
- RoutedEventHandlerInfo.cs
- BaseDataList.cs
- QilValidationVisitor.cs
- ExpressionConverter.cs
- Types.cs
- MessageHeaderInfoTraceRecord.cs
- Span.cs
- ControlValuePropertyAttribute.cs
- XmlIlTypeHelper.cs
- ToolStripComboBox.cs
- TabPanel.cs
- CryptoConfig.cs
- HierarchicalDataBoundControlAdapter.cs
- FontFamilyConverter.cs
- ControlUtil.cs
- ClientOptions.cs
- TimelineCollection.cs
- InternalMappingException.cs
- TypeSystem.cs
- ShaderRenderModeValidation.cs
- MediaPlayer.cs
- XmlEncodedRawTextWriter.cs
- SiteMapDataSourceView.cs
- BigInt.cs
- ValidatedControlConverter.cs
- EventHandlers.cs
- PlainXmlWriter.cs
- ColumnMapTranslator.cs
- ThreadStaticAttribute.cs
- Keywords.cs
- SoapHeaders.cs
- QuestionEventArgs.cs
- XamlSerializerUtil.cs
- TypeToken.cs
- DataGridViewRowHeaderCell.cs
- LocationUpdates.cs
- XhtmlCssHandler.cs
- UIAgentAsyncParams.cs
- UnSafeCharBuffer.cs
- UnsafeNativeMethodsTablet.cs
- ConfigurationPropertyCollection.cs
- ReadOnlyMetadataCollection.cs
- DialogResultConverter.cs
- SplayTreeNode.cs
- NameSpaceExtractor.cs
- LocalizabilityAttribute.cs
- BaseAutoFormat.cs
- ResolveResponseInfo.cs
- EntityClientCacheEntry.cs
- XmlUrlResolver.cs
- WaveHeader.cs
- HitTestResult.cs
- EllipseGeometry.cs
- ToolStripOverflowButton.cs
- AnnotationHelper.cs
- HtmlControl.cs
- GroupDescription.cs
- TransactionChannelFaultConverter.cs
- SystemWebExtensionsSectionGroup.cs
- CorrelationQuery.cs
- SettingsPropertyValue.cs
- SecurityElement.cs
- WCFBuildProvider.cs
- ObjectStateFormatter.cs
- SettingsBase.cs
- ChangeDirector.cs
- DetailsViewDeleteEventArgs.cs
- HMACSHA1.cs
- QilReference.cs
- formatter.cs
- DesignerHierarchicalDataSourceView.cs
- ScrollItemProviderWrapper.cs
- ObjectTypeMapping.cs
- PropertyOverridesTypeEditor.cs
- TextEncodedRawTextWriter.cs
- SecurityVerifiedMessage.cs
- SqlProvider.cs
- Transform3D.cs
- InputMethod.cs
- BamlRecordHelper.cs
- IISMapPath.cs
- ReadOnlyMetadataCollection.cs
- ExpressionEditorAttribute.cs
- SystemIPv6InterfaceProperties.cs
- ParentUndoUnit.cs
- ChangeInterceptorAttribute.cs
- CipherData.cs
- InProcStateClientManager.cs
- SafeFindHandle.cs
- IdnMapping.cs
- FixedSOMTableRow.cs
- BooleanFacetDescriptionElement.cs
- LinkGrep.cs
- FragmentNavigationEventArgs.cs
- XmlSchemaAppInfo.cs
- securitycriticaldata.cs
- BulletedList.cs
- FlowSwitchLink.cs
- ViewPort3D.cs