Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MappingException.cs
- PropertyValueUIItem.cs
- Socket.cs
- EventLog.cs
- WorkflowIdleElement.cs
- TypedTableBase.cs
- WorkflowDesignerColors.cs
- StateDesigner.Layouts.cs
- ConvertTextFrag.cs
- ElementHost.cs
- ProgressBarRenderer.cs
- lengthconverter.cs
- ActiveXSite.cs
- AttributeCollection.cs
- followingsibling.cs
- ShaderEffect.cs
- WinFormsSecurity.cs
- Base64Encoder.cs
- JpegBitmapEncoder.cs
- SocketException.cs
- GenericWebPart.cs
- Utils.cs
- PropertyToken.cs
- ThreadStateException.cs
- DigestTraceRecordHelper.cs
- CLSCompliantAttribute.cs
- SafeReversePInvokeHandle.cs
- RandomDelaySendsAsyncResult.cs
- TraceData.cs
- ComponentResourceManager.cs
- TimeSpanValidator.cs
- PaintValueEventArgs.cs
- BinaryExpression.cs
- TextLineResult.cs
- PersonalizationStateInfo.cs
- DatePickerDateValidationErrorEventArgs.cs
- ClientFormsAuthenticationCredentials.cs
- HostingEnvironmentException.cs
- PathSegment.cs
- PartitionedStreamMerger.cs
- XmlAttributeOverrides.cs
- TreeViewItemAutomationPeer.cs
- RSAOAEPKeyExchangeDeformatter.cs
- CompilerGeneratedAttribute.cs
- RowToParametersTransformer.cs
- SemaphoreSlim.cs
- ExceptionValidationRule.cs
- SHA1CryptoServiceProvider.cs
- OdbcErrorCollection.cs
- SpeakCompletedEventArgs.cs
- XmlILAnnotation.cs
- SafeBitVector32.cs
- SelectionProcessor.cs
- HandlerFactoryCache.cs
- LinqDataSourceStatusEventArgs.cs
- DiscoveryServiceExtension.cs
- MetadataSerializer.cs
- SmtpException.cs
- ProtectedProviderSettings.cs
- ErrorWebPart.cs
- ToolStripPanelRow.cs
- ConsumerConnectionPointCollection.cs
- WebBrowser.cs
- Stylesheet.cs
- SchemaDeclBase.cs
- ReversePositionQuery.cs
- ServiceDescription.cs
- Menu.cs
- IntSecurity.cs
- CompilationLock.cs
- EndpointIdentityExtension.cs
- TagMapInfo.cs
- Oid.cs
- DocumentGrid.cs
- SystemInfo.cs
- LockCookie.cs
- JsonStringDataContract.cs
- EventSetterHandlerConverter.cs
- FontDifferentiator.cs
- TabRenderer.cs
- TimeoutTimer.cs
- GetPageNumberCompletedEventArgs.cs
- EntitySqlQueryCacheEntry.cs
- FontNameConverter.cs
- UnsignedPublishLicense.cs
- JsonReaderWriterFactory.cs
- TypeSystemProvider.cs
- HttpContext.cs
- PolyBezierSegment.cs
- MDIControlStrip.cs
- infer.cs
- XmlSerializerNamespaces.cs
- Vector3DCollection.cs
- InputBuffer.cs
- MobileTextWriter.cs
- ToolStripSystemRenderer.cs
- TransformGroup.cs
- CollectionExtensions.cs
- OdbcDataReader.cs
- FieldTemplateUserControl.cs