Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / StringArrayConverter.cs / 1305376 / 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; // ////// 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
- ObjectDataSourceMethodEventArgs.cs
- DocumentSequence.cs
- Ops.cs
- DiagnosticTraceSchemas.cs
- DeclarativeCatalogPart.cs
- Calendar.cs
- DropSourceBehavior.cs
- FontStretch.cs
- Control.cs
- SamlSubject.cs
- ListInitExpression.cs
- OverflowException.cs
- QfeChecker.cs
- TrackingMemoryStreamFactory.cs
- BCryptSafeHandles.cs
- Delegate.cs
- SafeUserTokenHandle.cs
- SerializationFieldInfo.cs
- TableRow.cs
- FilterEventArgs.cs
- NumberFunctions.cs
- HtmlSelect.cs
- NetworkInformationPermission.cs
- PerfProviderCollection.cs
- Main.cs
- XmlNode.cs
- ACL.cs
- StylusPointCollection.cs
- Model3DGroup.cs
- lengthconverter.cs
- ListViewInsertedEventArgs.cs
- UriTemplateCompoundPathSegment.cs
- ExpandCollapsePattern.cs
- ImportDesigner.xaml.cs
- XmlTextWriter.cs
- StyleHelper.cs
- ContentControl.cs
- ObjectStorage.cs
- OletxEnlistment.cs
- DLinqDataModelProvider.cs
- VisualTarget.cs
- ClientConvert.cs
- TrustSection.cs
- TextSelectionHelper.cs
- PrintController.cs
- WeakReferenceEnumerator.cs
- BamlResourceSerializer.cs
- ReliabilityContractAttribute.cs
- SerializerWriterEventHandlers.cs
- StrokeFIndices.cs
- Viewport3DAutomationPeer.cs
- Configuration.cs
- ObjectQueryExecutionPlan.cs
- BulletDecorator.cs
- QueryCacheEntry.cs
- StandardCommandToolStripMenuItem.cs
- RequestQueue.cs
- CommonServiceBehaviorElement.cs
- StrokeFIndices.cs
- DataGridTextBoxColumn.cs
- AuthenticationService.cs
- PeerInvitationResponse.cs
- FormViewUpdateEventArgs.cs
- WebPartDescription.cs
- HtmlTable.cs
- FactoryRecord.cs
- LinqDataSourceContextData.cs
- BufferModeSettings.cs
- PageBreakRecord.cs
- StrongNamePublicKeyBlob.cs
- StateMachineHelpers.cs
- XmlSecureResolver.cs
- TrustLevelCollection.cs
- XmlAttributes.cs
- XmlSchemaRedefine.cs
- TextBox.cs
- CompModSwitches.cs
- Math.cs
- TypeConverterHelper.cs
- CodeTypeDelegate.cs
- DialogResultConverter.cs
- Content.cs
- XmlSchemaValidator.cs
- DateTimeStorage.cs
- WebReferencesBuildProvider.cs
- ThemeDirectoryCompiler.cs
- CultureSpecificStringDictionary.cs
- StylusTip.cs
- SendKeys.cs
- SequentialUshortCollection.cs
- XmlNodeReader.cs
- StylusPlugin.cs
- LinkArea.cs
- HtmlControl.cs
- PrintSchema.cs
- AgileSafeNativeMemoryHandle.cs
- ScriptResourceHandler.cs
- WebEventCodes.cs
- ActivityExecutorOperation.cs
- IDQuery.cs