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
- PolicyUnit.cs
- PeerToPeerException.cs
- ImageUrlEditor.cs
- AliasGenerator.cs
- SessionStateUtil.cs
- SqlDataReaderSmi.cs
- StrongNameIdentityPermission.cs
- TimeSpan.cs
- While.cs
- SettingsPropertyCollection.cs
- CaseInsensitiveHashCodeProvider.cs
- Rect.cs
- RegularExpressionValidator.cs
- FixedStringLookup.cs
- transactioncontext.cs
- XsdCachingReader.cs
- SplitterEvent.cs
- DisplayMemberTemplateSelector.cs
- StreamWriter.cs
- AutoGeneratedFieldProperties.cs
- XmlWrappingReader.cs
- Paragraph.cs
- TextEditorContextMenu.cs
- BitmapEffectInput.cs
- M3DUtil.cs
- MonthCalendar.cs
- ValidationPropertyAttribute.cs
- QilTypeChecker.cs
- BitmapMetadataEnumerator.cs
- Typeface.cs
- OdbcParameterCollection.cs
- __ConsoleStream.cs
- OleDbRowUpdatingEvent.cs
- ClientRuntimeConfig.cs
- WindowsEditBox.cs
- ApplyTemplatesAction.cs
- MergeFailedEvent.cs
- SspiSecurityTokenParameters.cs
- Exceptions.cs
- DataTableMapping.cs
- RequestStatusBarUpdateEventArgs.cs
- Compiler.cs
- FtpRequestCacheValidator.cs
- ToolStripItemRenderEventArgs.cs
- ClientRolePrincipal.cs
- mactripleDES.cs
- ControlBuilderAttribute.cs
- PersistChildrenAttribute.cs
- ReferencedAssemblyResolver.cs
- SByte.cs
- TransformerTypeCollection.cs
- StreamWriter.cs
- XhtmlTextWriter.cs
- ManipulationStartingEventArgs.cs
- Stroke2.cs
- ConfigXmlElement.cs
- AsyncStreamReader.cs
- ConsoleCancelEventArgs.cs
- SqlUserDefinedAggregateAttribute.cs
- RequestContextBase.cs
- EndpointDiscoveryBehavior.cs
- SQLResource.cs
- QilBinary.cs
- WebPartTransformerAttribute.cs
- _FtpControlStream.cs
- OperationCanceledException.cs
- PrincipalPermission.cs
- OciHandle.cs
- SHA256Cng.cs
- ExtendedPropertyDescriptor.cs
- VSWCFServiceContractGenerator.cs
- GreenMethods.cs
- EncryptedData.cs
- ExpandedProjectionNode.cs
- LoginAutoFormat.cs
- BaseCollection.cs
- HttpListenerException.cs
- AuthenticationModuleElementCollection.cs
- RegisteredDisposeScript.cs
- CollectionChangeEventArgs.cs
- Int64Animation.cs
- Model3D.cs
- CaseInsensitiveHashCodeProvider.cs
- ConsoleKeyInfo.cs
- Cursor.cs
- UnsafeNativeMethodsTablet.cs
- activationcontext.cs
- XPathException.cs
- BindStream.cs
- ProxyGenerationError.cs
- ObjectAnimationBase.cs
- ContextBase.cs
- CreateUserErrorEventArgs.cs
- XmlSiteMapProvider.cs
- HttpDictionary.cs
- DataTableMapping.cs
- XmlDocumentViewSchema.cs
- WorkflowApplication.cs
- ComponentCodeDomSerializer.cs
- Maps.cs