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
- PolyLineSegment.cs
- IdnElement.cs
- StaticSiteMapProvider.cs
- MruCache.cs
- TextProperties.cs
- ScrollItemPattern.cs
- SchemaMapping.cs
- PackagePartCollection.cs
- NativeRecognizer.cs
- CompositeControlDesigner.cs
- AssemblyAttributesGoHere.cs
- OrderedDictionary.cs
- UserControlParser.cs
- ToolStripCodeDomSerializer.cs
- ListViewUpdateEventArgs.cs
- DecoderFallbackWithFailureFlag.cs
- BindingContext.cs
- PropertyCollection.cs
- AuthenticationConfig.cs
- OdbcException.cs
- DefinitionBase.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- StylusPointProperty.cs
- HtmlObjectListAdapter.cs
- HandlerBase.cs
- WebPartZoneCollection.cs
- GlobalEventManager.cs
- SafeLocalAllocation.cs
- AnyAllSearchOperator.cs
- AnalyzedTree.cs
- DataControlFieldCell.cs
- HtmlAnchor.cs
- TimeIntervalCollection.cs
- LinkLabel.cs
- Point4DConverter.cs
- TransformerConfigurationWizardBase.cs
- ExpressionVisitorHelpers.cs
- VersionedStream.cs
- AtomContentProperty.cs
- counter.cs
- RichTextBoxContextMenu.cs
- WinEventHandler.cs
- Calendar.cs
- DurableEnlistmentState.cs
- IODescriptionAttribute.cs
- DocumentGridContextMenu.cs
- DataPagerFieldItem.cs
- TypeForwardedToAttribute.cs
- NavigationWindow.cs
- RowBinding.cs
- RootContext.cs
- DetailsViewCommandEventArgs.cs
- HtmlForm.cs
- CheckedPointers.cs
- TypeAccessException.cs
- MessageUtil.cs
- ResXFileRef.cs
- UriWriter.cs
- TextReturnReader.cs
- FileLoadException.cs
- XmlTypeMapping.cs
- TreeBuilder.cs
- DistinctQueryOperator.cs
- TargetException.cs
- BaseParser.cs
- SoapAttributeAttribute.cs
- Transform.cs
- AsyncOperation.cs
- Form.cs
- SourceElementsCollection.cs
- HttpCacheVaryByContentEncodings.cs
- HttpCacheVary.cs
- ListMarkerLine.cs
- MessageSmuggler.cs
- X509ChainElement.cs
- ValueTypeFixupInfo.cs
- AssemblyLoader.cs
- CustomActivityDesigner.cs
- DataBoundLiteralControl.cs
- CodeStatement.cs
- WsdlServiceChannelBuilder.cs
- MenuEventArgs.cs
- HierarchicalDataBoundControlAdapter.cs
- GridViewPageEventArgs.cs
- ObjectHandle.cs
- ConnectionStringSettings.cs
- SQLResource.cs
- InitializerFacet.cs
- CalendarButtonAutomationPeer.cs
- PackageRelationship.cs
- WebPartTracker.cs
- WebPartConnectionsDisconnectVerb.cs
- DiagnosticsConfigurationHandler.cs
- RightsManagementEncryptedStream.cs
- SecurityElementBase.cs
- MapPathBasedVirtualPathProvider.cs
- TypeSchema.cs
- FormViewPagerRow.cs
- ParentControlDesigner.cs
- TextRenderer.cs