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
- WebExceptionStatus.cs
- StrongNameMembershipCondition.cs
- LinqToSqlWrapper.cs
- KnownTypeAttribute.cs
- ExpressionPrinter.cs
- Quaternion.cs
- XPathQilFactory.cs
- ToolStripPanelRow.cs
- StackOverflowException.cs
- DuplicateWaitObjectException.cs
- ToolStripItemImageRenderEventArgs.cs
- IgnoreSection.cs
- ByteAnimationUsingKeyFrames.cs
- WpfKnownTypeInvoker.cs
- Tracer.cs
- EntryIndex.cs
- IgnorePropertiesAttribute.cs
- EventSchemaTraceListener.cs
- HyperLinkColumn.cs
- SmiMetaDataProperty.cs
- TransformedBitmap.cs
- OleDbPropertySetGuid.cs
- BamlResourceContent.cs
- AsyncOperationManager.cs
- XmlTextAttribute.cs
- TextEndOfLine.cs
- TransactionTable.cs
- MatrixValueSerializer.cs
- SoapObjectWriter.cs
- ScrollEvent.cs
- ViewManager.cs
- oledbconnectionstring.cs
- KeyValueInternalCollection.cs
- ImageMap.cs
- ISFClipboardData.cs
- ContextProperty.cs
- RoutedEvent.cs
- TraceLevelStore.cs
- MimeBasePart.cs
- GroupDescription.cs
- XmlSchemaSimpleContentExtension.cs
- RegexCompilationInfo.cs
- IList.cs
- ZipIOExtraFieldZip64Element.cs
- ReferentialConstraintRoleElement.cs
- XmlChildNodes.cs
- EventLogLink.cs
- DbDataReader.cs
- InternalConfigSettingsFactory.cs
- XmlSchemaProviderAttribute.cs
- ActiveXSite.cs
- CodeTypeDelegate.cs
- CodeParameterDeclarationExpression.cs
- ArgumentValidation.cs
- DataGridViewDataConnection.cs
- DataKey.cs
- UIPropertyMetadata.cs
- HttpCachePolicy.cs
- TextTreeTextElementNode.cs
- XmlNotation.cs
- AssemblySettingAttributes.cs
- OdbcCommand.cs
- DateTimePicker.cs
- RegistryKey.cs
- ContentElementAutomationPeer.cs
- TypeElementCollection.cs
- RuleRefElement.cs
- TransactionFlowBindingElementImporter.cs
- UInt64Storage.cs
- TextDecoration.cs
- ProxyManager.cs
- LinearGradientBrush.cs
- FlowDocumentPaginator.cs
- BamlRecordHelper.cs
- Resources.Designer.cs
- TripleDES.cs
- DataGridState.cs
- DES.cs
- CompositeFontParser.cs
- ToolStripMenuItem.cs
- EnglishPluralizationService.cs
- CompilationPass2Task.cs
- SQLMoneyStorage.cs
- AutomationFocusChangedEventArgs.cs
- SourceFileBuildProvider.cs
- EntityTypeBase.cs
- ServerReliableChannelBinder.cs
- PartitionResolver.cs
- GlyphRunDrawing.cs
- BoundPropertyEntry.cs
- OneToOneMappingSerializer.cs
- RoleManagerSection.cs
- RowSpanVector.cs
- CapabilitiesState.cs
- DataContext.cs
- TimelineCollection.cs
- AutomationElementCollection.cs
- SByte.cs
- MenuItemCollection.cs
- SkinBuilder.cs