Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Convert.cs
- ElementMarkupObject.cs
- LineServices.cs
- EmptyControlCollection.cs
- SerializationObjectManager.cs
- SafeRightsManagementQueryHandle.cs
- ResolveResponseInfo.cs
- FormViewModeEventArgs.cs
- MetadataItemEmitter.cs
- ProjectionAnalyzer.cs
- SchemaMerger.cs
- HttpCachePolicyElement.cs
- future.cs
- TdsValueSetter.cs
- MessageSecurityException.cs
- DelayDesigner.cs
- BindingNavigator.cs
- OperationCanceledException.cs
- ServiceOperationWrapper.cs
- DirectoryNotFoundException.cs
- DecoderFallback.cs
- ObjectStorage.cs
- WebPartsPersonalization.cs
- JsonWriterDelegator.cs
- invalidudtexception.cs
- ClientRuntimeConfig.cs
- StrongTypingException.cs
- RequestSecurityTokenResponse.cs
- SingleAnimationBase.cs
- PropertyDescriptorComparer.cs
- GroupBoxAutomationPeer.cs
- NegotiationTokenProvider.cs
- Metadata.cs
- CachedFontFace.cs
- Animatable.cs
- TTSVoice.cs
- FontStretch.cs
- MSHTMLHost.cs
- SqlMethodAttribute.cs
- LayoutEvent.cs
- Int32Converter.cs
- ListenerElementsCollection.cs
- AnnotationResourceCollection.cs
- DataListItem.cs
- MemberBinding.cs
- WebPartConnectVerb.cs
- XmlTypeAttribute.cs
- XmlIlTypeHelper.cs
- GPPOINT.cs
- UpdateEventArgs.cs
- WriteableBitmap.cs
- EntityParameter.cs
- EncoderParameters.cs
- SystemSounds.cs
- CompiledQueryCacheKey.cs
- DataGridViewTextBoxEditingControl.cs
- PassportPrincipal.cs
- XsltLoader.cs
- TextContainer.cs
- SiblingIterators.cs
- UniformGrid.cs
- PeerTransportElement.cs
- ValueConversionAttribute.cs
- AdPostCacheSubstitution.cs
- VariableAction.cs
- RenderDataDrawingContext.cs
- HighlightVisual.cs
- AnnotationHighlightLayer.cs
- InsufficientMemoryException.cs
- VBCodeProvider.cs
- HttpHandlersSection.cs
- NamedPipeConnectionPool.cs
- IntellisenseTextBox.cs
- Visitor.cs
- PerspectiveCamera.cs
- TextBoxLine.cs
- XmlLanguageConverter.cs
- ACL.cs
- CompiledRegexRunner.cs
- DataGridViewHitTestInfo.cs
- TableLayoutSettings.cs
- SmtpFailedRecipientsException.cs
- SHA1.cs
- DesignerVerb.cs
- BaseCodeDomTreeGenerator.cs
- RegexInterpreter.cs
- DeclarativeCatalogPart.cs
- ErrorHandler.cs
- XPathMessageFilterElementCollection.cs
- SafeFileMappingHandle.cs
- ExpressionBuilderContext.cs
- Style.cs
- RsaSecurityToken.cs
- RemotingConfiguration.cs
- ValidationSummary.cs
- ScrollItemPatternIdentifiers.cs
- X509CertificateInitiatorServiceCredential.cs
- DataGridRowDetailsEventArgs.cs
- UniqueID.cs
- ComboBoxRenderer.cs