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
- AllMembershipCondition.cs
- dataprotectionpermission.cs
- DisplayNameAttribute.cs
- DataExpression.cs
- AnonymousIdentificationModule.cs
- AttributeTableBuilder.cs
- ImpersonationContext.cs
- RuntimeConfigurationRecord.cs
- LiteralTextParser.cs
- XmlSchemaSimpleTypeUnion.cs
- PolicyValidationException.cs
- ReflectionHelper.cs
- Qualifier.cs
- MemberPath.cs
- OutputCacheSection.cs
- WSDualHttpBinding.cs
- ETagAttribute.cs
- DefaultValidator.cs
- PolyQuadraticBezierSegment.cs
- TextServicesCompartmentContext.cs
- TimeEnumHelper.cs
- DrawingVisual.cs
- EditorPartChrome.cs
- WebReferencesBuildProvider.cs
- _SSPIWrapper.cs
- XsltLoader.cs
- AlphaSortedEnumConverter.cs
- FixedSOMTableCell.cs
- AccessedThroughPropertyAttribute.cs
- Rule.cs
- DocumentXPathNavigator.cs
- MultitargetUtil.cs
- SqlDataReaderSmi.cs
- ValidationPropertyAttribute.cs
- GridViewAutomationPeer.cs
- LogWriteRestartAreaAsyncResult.cs
- EqualityComparer.cs
- GridViewDeleteEventArgs.cs
- TextSearch.cs
- BooleanAnimationUsingKeyFrames.cs
- DatePickerTextBox.cs
- BuildProvider.cs
- XmlIgnoreAttribute.cs
- GregorianCalendarHelper.cs
- CookielessHelper.cs
- ToolboxItemImageConverter.cs
- EntityDataSourceChangingEventArgs.cs
- Header.cs
- XmlEncApr2001.cs
- OracleDataReader.cs
- BindingContext.cs
- FullTextBreakpoint.cs
- BlobPersonalizationState.cs
- Debugger.cs
- PrivilegeNotHeldException.cs
- SqlReferenceCollection.cs
- CompositeActivityTypeDescriptor.cs
- FormViewModeEventArgs.cs
- InputBindingCollection.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- ProfileParameter.cs
- unitconverter.cs
- HostProtectionException.cs
- XPathBuilder.cs
- AnnotationResourceCollection.cs
- DrawingState.cs
- XamlFilter.cs
- UIElementPropertyUndoUnit.cs
- DNS.cs
- XmlAttributes.cs
- TypeRestriction.cs
- FlowDocumentReaderAutomationPeer.cs
- Clause.cs
- EdmError.cs
- ReversePositionQuery.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- SafeFileMappingHandle.cs
- arabicshape.cs
- GridViewSortEventArgs.cs
- RuntimeTransactionHandle.cs
- Attributes.cs
- ClockGroup.cs
- RightsManagementInformation.cs
- EmptyEnumerator.cs
- DropShadowBitmapEffect.cs
- EditorZoneDesigner.cs
- FontFamily.cs
- Int32Animation.cs
- DataGridViewDataErrorEventArgs.cs
- BatchParser.cs
- FileDataSourceCache.cs
- SafeReadContext.cs
- UpdateTracker.cs
- RemotingConfigParser.cs
- BaseProcessProtocolHandler.cs
- MenuItemStyle.cs
- PartDesigner.cs
- TemplateColumn.cs
- PolicyReader.cs
- TrailingSpaceComparer.cs