Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / StringArrayConverter.cs / 1305376 / StringArrayConverter.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI.WebControls {
using System.ComponentModel.Design;
using System;
using System.ComponentModel;
using System.Collections;
using System.Globalization;
//
///
/// Converts a string separated by commas to and from
/// an array of strings.
///
public class StringArrayConverter : TypeConverter {
///
/// Determines if the specified data type can be converted to an array of strings.
///
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
if (sourceType == typeof(string)) {
return true;
}
return false;
}
///
/// Parses a string separated by
/// commas into an array of strings.
///
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) {
if (value is string) {
if (((string)value).Length == 0) {
return new string[0];
}
// hard code comma, since it is persisted to HTML
//
string[] names = ((string)value).Split(new char[] {','});
for (int i=0; i
/// Creates a string separated
/// by commas from an array of strings.
///
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
if (destinationType == typeof(string)) {
if (value == null) {
return String.Empty;
}
// hard code comma, since it is persisted to HTML
//
return string.Join(",", ((string[])value));
}
throw GetConvertToException(value, destinationType);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI.WebControls {
using System.ComponentModel.Design;
using System;
using System.ComponentModel;
using System.Collections;
using System.Globalization;
//
///
/// Converts a string separated by commas to and from
/// an array of strings.
///
public class StringArrayConverter : TypeConverter {
///
/// Determines if the specified data type can be converted to an array of strings.
///
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
if (sourceType == typeof(string)) {
return true;
}
return false;
}
///
/// Parses a string separated by
/// commas into an array of strings.
///
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) {
if (value is string) {
if (((string)value).Length == 0) {
return new string[0];
}
// hard code comma, since it is persisted to HTML
//
string[] names = ((string)value).Split(new char[] {','});
for (int i=0; i
/// Creates a string separated
/// by commas from an array of strings.
///
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
if (destinationType == typeof(string)) {
if (value == null) {
return String.Empty;
}
// hard code comma, since it is persisted to HTML
//
return string.Join(",", ((string[])value));
}
throw GetConvertToException(value, destinationType);
}
}
}
// 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
- RequestQueue.cs
- MultidimensionalArrayItemReference.cs
- NavigationWindowAutomationPeer.cs
- MsmqMessageProperty.cs
- FindCriteriaApril2005.cs
- DeferredReference.cs
- HandleCollector.cs
- CommandConverter.cs
- ClientRuntimeConfig.cs
- ContainerParaClient.cs
- ItemCheckedEvent.cs
- SemanticKeyElement.cs
- PointHitTestParameters.cs
- StateItem.cs
- ContextMenuStripActionList.cs
- EpmTargetTree.cs
- AtlasWeb.Designer.cs
- NameValueConfigurationCollection.cs
- ProviderUtil.cs
- WindowsSlider.cs
- IdentityNotMappedException.cs
- ToolStripItemImageRenderEventArgs.cs
- TriState.cs
- CornerRadiusConverter.cs
- PopupEventArgs.cs
- OdbcParameterCollection.cs
- XmlDataFileEditor.cs
- OneOfConst.cs
- objectquery_tresulttype.cs
- regiisutil.cs
- ApplicationSettingsBase.cs
- Matrix3D.cs
- ConfigurationPermission.cs
- LicFileLicenseProvider.cs
- WindowsSpinner.cs
- ObjectToken.cs
- PropertyGroupDescription.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- DynamicField.cs
- COM2FontConverter.cs
- GradientStop.cs
- VisualBasicValue.cs
- ServiceRoute.cs
- PropertyInformationCollection.cs
- Iis7Helper.cs
- ObfuscateAssemblyAttribute.cs
- OdbcDataReader.cs
- RectAnimationClockResource.cs
- CodeSubDirectoriesCollection.cs
- DesignerAttribute.cs
- LinqToSqlWrapper.cs
- UnicodeEncoding.cs
- ItemsPresenter.cs
- DataControlFieldsEditor.cs
- TimeIntervalCollection.cs
- DataPointer.cs
- DataTableTypeConverter.cs
- unitconverter.cs
- TemplateDefinition.cs
- XmlNotation.cs
- StopStoryboard.cs
- PasswordBoxAutomationPeer.cs
- LocatorPart.cs
- TableItemStyle.cs
- BackStopAuthenticationModule.cs
- LogSwitch.cs
- Table.cs
- AsymmetricCryptoHandle.cs
- PowerStatus.cs
- SslStream.cs
- PointLightBase.cs
- PathBox.cs
- Stacktrace.cs
- SqlDataSourceCommandEventArgs.cs
- GatewayDefinition.cs
- TextSearch.cs
- WaveHeader.cs
- SharedUtils.cs
- AxisAngleRotation3D.cs
- TextEmbeddedObject.cs
- CalendarDay.cs
- EnterpriseServicesHelper.cs
- StringSource.cs
- DiffuseMaterial.cs
- DataGridTable.cs
- Console.cs
- DocumentGridContextMenu.cs
- ImageBrush.cs
- FormCollection.cs
- StylusPlugInCollection.cs
- AnnotationAuthorChangedEventArgs.cs
- ValidationHelper.cs
- CfgSemanticTag.cs
- AtomServiceDocumentSerializer.cs
- TextClipboardData.cs
- XmlSchemaSimpleTypeRestriction.cs
- GlyphTypeface.cs
- ActivityExecutorDelegateInfo.cs
- Panel.cs
- DataSourceExpressionCollection.cs