Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / WebControls / StringArrayConverter.cs / 2 / 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); } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PropertyIdentifier.cs
- SerialPinChanges.cs
- XmlAggregates.cs
- LogicalTreeHelper.cs
- SqlConnectionPoolGroupProviderInfo.cs
- DocumentViewerAutomationPeer.cs
- ManipulationVelocities.cs
- EncoderExceptionFallback.cs
- EntityParameter.cs
- TemplateBaseAction.cs
- IList.cs
- FloatUtil.cs
- RuntimeVariableList.cs
- ModelVisual3D.cs
- MoveSizeWinEventHandler.cs
- DesignerProperties.cs
- x509utils.cs
- ConfigurationFileMap.cs
- TableRowGroup.cs
- TTSEngineTypes.cs
- CodeIdentifier.cs
- RSAOAEPKeyExchangeDeformatter.cs
- documentsequencetextcontainer.cs
- _SSPIWrapper.cs
- RTTypeWrapper.cs
- ConfigXmlDocument.cs
- DetailsViewRow.cs
- XmlSchemaInclude.cs
- UriTemplateDispatchFormatter.cs
- EventWaitHandleSecurity.cs
- DesignerProperties.cs
- DefaultValueAttribute.cs
- EventProviderWriter.cs
- C14NUtil.cs
- Nullable.cs
- VoiceInfo.cs
- BufferedWebEventProvider.cs
- PiiTraceSource.cs
- InvokeSchedule.cs
- ConnectionPointCookie.cs
- XPathDocumentBuilder.cs
- PowerStatus.cs
- WebConfigurationHostFileChange.cs
- WmpBitmapEncoder.cs
- ApplicationActivator.cs
- ProcessProtocolHandler.cs
- EventData.cs
- XmlNamedNodeMap.cs
- WsdlInspector.cs
- DetailsViewPagerRow.cs
- XPathDocumentNavigator.cs
- BuildProvider.cs
- FieldAccessException.cs
- DrawingContext.cs
- CompositeControl.cs
- TypefaceMap.cs
- AnimationLayer.cs
- DataGridViewComboBoxColumnDesigner.cs
- ScriptingAuthenticationServiceSection.cs
- IResourceProvider.cs
- DtrList.cs
- ResourceDictionary.cs
- TaiwanCalendar.cs
- CapabilitiesRule.cs
- AuthenticatedStream.cs
- PixelShader.cs
- IIS7UserPrincipal.cs
- ChannelRequirements.cs
- FileCodeGroup.cs
- webeventbuffer.cs
- XmlSchemaAnnotation.cs
- FormViewUpdatedEventArgs.cs
- WorkflowApplicationException.cs
- NumberSubstitution.cs
- UnauthorizedAccessException.cs
- HeaderCollection.cs
- AssemblyInfo.cs
- ByteConverter.cs
- coordinatorfactory.cs
- DataGridColumnHeadersPresenterAutomationPeer.cs
- TcpSocketManager.cs
- PeerOutputChannel.cs
- ConfigurationUtility.cs
- TraceContextRecord.cs
- DockPatternIdentifiers.cs
- IndentTextWriter.cs
- ScriptingRoleServiceSection.cs
- GuidelineSet.cs
- TableNameAttribute.cs
- Stroke.cs
- ProcessModelInfo.cs
- Point3DCollection.cs
- RectAnimationUsingKeyFrames.cs
- Console.cs
- DeflateStream.cs
- ToolstripProfessionalRenderer.cs
- PointConverter.cs
- MessageQueueConverter.cs
- TrackingDataItem.cs
- RetrieveVirtualItemEventArgs.cs