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
- DocumentViewerAutomationPeer.cs
- SecurityContextTokenValidationException.cs
- WorkflowViewService.cs
- altserialization.cs
- HttpCookie.cs
- AvTrace.cs
- SqlRowUpdatedEvent.cs
- ResourceProviderFactory.cs
- SerializationEventsCache.cs
- RangeEnumerable.cs
- Validator.cs
- MsmqIntegrationChannelFactory.cs
- DataGridViewCellLinkedList.cs
- TrimSurroundingWhitespaceAttribute.cs
- SettingsProperty.cs
- Int16Animation.cs
- ObjectReaderCompiler.cs
- CompilerGlobalScopeAttribute.cs
- ReadOnlyCollectionBase.cs
- GifBitmapDecoder.cs
- MasterPage.cs
- CollectionViewGroupInternal.cs
- PcmConverter.cs
- Imaging.cs
- NumericUpDownAcceleration.cs
- ItemContainerPattern.cs
- DropTarget.cs
- MatrixAnimationUsingPath.cs
- QueueProcessor.cs
- UnaryOperationBinder.cs
- PKCS1MaskGenerationMethod.cs
- GenericEnumerator.cs
- XmlHierarchicalDataSourceView.cs
- ByteStack.cs
- xamlnodes.cs
- GroupItem.cs
- InternalBase.cs
- PerformanceCounterPermissionAttribute.cs
- MessageSmuggler.cs
- WebBrowserUriTypeConverter.cs
- FlowLayoutPanel.cs
- DBSqlParserColumnCollection.cs
- LZCodec.cs
- Light.cs
- GeneralTransformGroup.cs
- MultiView.cs
- EntityUtil.cs
- _UriSyntax.cs
- HelpInfo.cs
- OperatorExpressions.cs
- VarRefManager.cs
- DropShadowBitmapEffect.cs
- SelectQueryOperator.cs
- VectorCollectionConverter.cs
- Dispatcher.cs
- ActiveXHost.cs
- DebugView.cs
- BinaryParser.cs
- EventManager.cs
- CodeVariableDeclarationStatement.cs
- XmlParserContext.cs
- ResizingMessageFilter.cs
- PriorityQueue.cs
- MonthCalendar.cs
- MessageSecurityVersionConverter.cs
- GACIdentityPermission.cs
- BaseDataBoundControl.cs
- ResolvedKeyFrameEntry.cs
- GeneralTransform3D.cs
- SimpleType.cs
- PeerCredential.cs
- BuildProvider.cs
- HostExecutionContextManager.cs
- RouteValueExpressionBuilder.cs
- SpellerStatusTable.cs
- TransactionTraceIdentifier.cs
- TextTreeFixupNode.cs
- GenericAuthenticationEventArgs.cs
- ExpressionBuilderContext.cs
- EntityDataSourceStatementEditor.cs
- FtpWebRequest.cs
- TypeGeneratedEventArgs.cs
- FixedDSBuilder.cs
- IList.cs
- XmlMembersMapping.cs
- SectionXmlInfo.cs
- ServiceDescriptionSerializer.cs
- TreeNode.cs
- SafeHandle.cs
- PngBitmapDecoder.cs
- RestClientProxyHandler.cs
- ToolStripItemRenderEventArgs.cs
- GetPageNumberCompletedEventArgs.cs
- pingexception.cs
- FileUtil.cs
- Site.cs
- PointConverter.cs
- SliderAutomationPeer.cs
- ContainerUtilities.cs
- CacheChildrenQuery.cs