Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / xsp / System / Web / UI / WebControls / StringArrayConverter.cs / 1 / 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;
using System.Security.Permissions;
//
///
/// Converts a string separated by commas to and from
/// an array of strings.
///
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
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;
using System.Security.Permissions;
//
///
/// Converts a string separated by commas to and from
/// an array of strings.
///
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
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
- UserNameSecurityToken.cs
- Italic.cs
- InputChannelAcceptor.cs
- SecureEnvironment.cs
- CheckedListBox.cs
- MemberHolder.cs
- PropertiesTab.cs
- StorageConditionPropertyMapping.cs
- XsdBuilder.cs
- ListControl.cs
- MailAddress.cs
- ISessionStateStore.cs
- ReadOnlyObservableCollection.cs
- DocumentViewerBaseAutomationPeer.cs
- ChannelServices.cs
- EnumConverter.cs
- NetSectionGroup.cs
- CodeIdentifier.cs
- SingleAnimationBase.cs
- PairComparer.cs
- ModifierKeysConverter.cs
- UInt16Storage.cs
- OdbcCommand.cs
- ButtonFieldBase.cs
- InfoCardConstants.cs
- BrowserTree.cs
- KeyInfo.cs
- IsolatedStorage.cs
- StringBuilder.cs
- SecurityHeaderElementInferenceEngine.cs
- DBCSCodePageEncoding.cs
- ServiceOperationParameter.cs
- SiteMapPath.cs
- IisTraceWebEventProvider.cs
- PreloadedPackages.cs
- PageStatePersister.cs
- MessageSmuggler.cs
- TableLayoutRowStyleCollection.cs
- HtmlInputHidden.cs
- StateMachineHelpers.cs
- DataContractSet.cs
- DesignerSerializationOptionsAttribute.cs
- XpsS0ValidatingLoader.cs
- MasterPageCodeDomTreeGenerator.cs
- TraceLog.cs
- TrackingProfileManager.cs
- Publisher.cs
- EntityClassGenerator.cs
- WsdlContractConversionContext.cs
- EventsTab.cs
- InfoCardTrace.cs
- RoutedUICommand.cs
- HttpResponseHeader.cs
- PanelContainerDesigner.cs
- PropertyCollection.cs
- Scanner.cs
- DateTimeStorage.cs
- Events.cs
- WebPartZoneCollection.cs
- Pen.cs
- UserControlBuildProvider.cs
- CookieParameter.cs
- AuthenticationConfig.cs
- DesignSurfaceManager.cs
- ConsumerConnectionPointCollection.cs
- DataGridViewRowsRemovedEventArgs.cs
- BinaryNegotiation.cs
- StrongNameSignatureInformation.cs
- InputScope.cs
- XamlSerializationHelper.cs
- FrameworkElement.cs
- HtmlInputText.cs
- SiteMapNode.cs
- DES.cs
- TraceUtility.cs
- PageStatePersister.cs
- EDesignUtil.cs
- LastQueryOperator.cs
- WebPartZoneBaseDesigner.cs
- _IPv6Address.cs
- XmlEventCache.cs
- CopyOfAction.cs
- AssemblyFilter.cs
- dataprotectionpermission.cs
- TypeValidationEventArgs.cs
- WindowsEditBox.cs
- Image.cs
- WindowsGraphics.cs
- AnimationClockResource.cs
- SoapExtension.cs
- GroupLabel.cs
- ScrollPattern.cs
- ProgressBarAutomationPeer.cs
- ManagedWndProcTracker.cs
- UInt32Storage.cs
- SizeConverter.cs
- ColumnTypeConverter.cs
- ZipQueryOperator.cs
- DynamicMethod.cs
- CapabilitiesPattern.cs