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; // ////// [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] public class StringArrayConverter : TypeConverter { ///Converts a string separated by commas to and from /// an array of strings. ////// public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string)) { return true; } return false; } ///Determines if the specified data type can be converted to 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; iParses a string separated by /// commas into an array of strings. ////// 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; // ////// [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] public class StringArrayConverter : TypeConverter { ///Converts a string separated by commas to and from /// an array of strings. ////// public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string)) { return true; } return false; } ///Determines if the specified data type can be converted to 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; iParses a string separated by /// commas into an array of strings. ////// 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
- FullTextLine.cs
- AuthorizationSection.cs
- SkinBuilder.cs
- DisplayNameAttribute.cs
- IPPacketInformation.cs
- PolyQuadraticBezierSegment.cs
- GeometryConverter.cs
- Verify.cs
- ObjectSet.cs
- TemplateBindingExtensionConverter.cs
- PropertySourceInfo.cs
- VectorCollectionConverter.cs
- QualifiedCellIdBoolean.cs
- EventlogProvider.cs
- XmlLoader.cs
- XPathException.cs
- RowToFieldTransformer.cs
- localization.cs
- PreloadedPackages.cs
- TypedElement.cs
- WaitHandleCannotBeOpenedException.cs
- ErrorHandler.cs
- DropDownList.cs
- ParameterInfo.cs
- HMACSHA1.cs
- ReliableSessionBindingElementImporter.cs
- StorageEntityContainerMapping.cs
- xmlglyphRunInfo.cs
- SHA256.cs
- SourceFileBuildProvider.cs
- FrameworkTemplate.cs
- UriTemplateQueryValue.cs
- CodeNamespaceCollection.cs
- DynamicDocumentPaginator.cs
- ellipse.cs
- BypassElement.cs
- ProxyHelper.cs
- BitmapEffectState.cs
- NameValueSectionHandler.cs
- DataGridViewComboBoxCell.cs
- DesignSurfaceCollection.cs
- TypeDelegator.cs
- TypeUtils.cs
- ArgumentValue.cs
- WindowInteractionStateTracker.cs
- StaticSiteMapProvider.cs
- RectValueSerializer.cs
- RSAPKCS1KeyExchangeFormatter.cs
- SocketPermission.cs
- TdsParser.cs
- _NtlmClient.cs
- CompositionAdorner.cs
- DbProviderFactories.cs
- Int16Storage.cs
- DesignerActionMethodItem.cs
- DataServiceHostFactory.cs
- ErrorFormatterPage.cs
- Mapping.cs
- Variable.cs
- DataObjectFieldAttribute.cs
- DatagridviewDisplayedBandsData.cs
- VectorCollection.cs
- Canvas.cs
- ButtonColumn.cs
- ContainerUtilities.cs
- CorrelationManager.cs
- TraceFilter.cs
- TextCompositionEventArgs.cs
- ConfigDefinitionUpdates.cs
- ItemAutomationPeer.cs
- latinshape.cs
- QilNode.cs
- ToolStripSettings.cs
- ReadOnlyMetadataCollection.cs
- Rect3D.cs
- ConnectionsZone.cs
- GridLengthConverter.cs
- FlowLayoutPanelDesigner.cs
- ConfigXmlCDataSection.cs
- ObjectDataSourceDesigner.cs
- Config.cs
- AsymmetricSignatureDeformatter.cs
- DeflateStream.cs
- SlipBehavior.cs
- DispatcherProcessingDisabled.cs
- Matrix3DValueSerializer.cs
- DeclarativeConditionsCollection.cs
- FormViewPageEventArgs.cs
- Attributes.cs
- UdpSocket.cs
- Brush.cs
- BreadCrumbTextConverter.cs
- Unit.cs
- TypeDependencyAttribute.cs
- PropertyChangeTracker.cs
- ConstructorBuilder.cs
- SimpleTableProvider.cs
- ServicePointManager.cs
- SortedList.cs
- XmlAtomicValue.cs