Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / xsp / System / Web / UI / WebControls / StringArrayConverter.cs / 5 / 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); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// 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); } } } // 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
- DataGridLinkButton.cs
- DataGridViewTextBoxCell.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- DistinctQueryOperator.cs
- ControlPersister.cs
- AttributeCollection.cs
- NullExtension.cs
- IIS7UserPrincipal.cs
- SqlDataSourceView.cs
- ConnectivityStatus.cs
- ParamArrayAttribute.cs
- XmlAttributeAttribute.cs
- BamlLocalizableResourceKey.cs
- VirtualPathExtension.cs
- EmptyControlCollection.cs
- CornerRadiusConverter.cs
- CaretElement.cs
- FtpWebResponse.cs
- ReadOnlyAttribute.cs
- InstallerTypeAttribute.cs
- CheckBox.cs
- UpdateCommand.cs
- ExecutionContext.cs
- EventKeyword.cs
- ObjectFullSpanRewriter.cs
- FusionWrap.cs
- SignatureHelper.cs
- VariantWrapper.cs
- DbCommandTree.cs
- DataBindEngine.cs
- XmlNodeList.cs
- MemberHolder.cs
- QueryableFilterUserControl.cs
- HttpHandlerAction.cs
- _Connection.cs
- ValidationResult.cs
- ErrorStyle.cs
- Help.cs
- PageStatePersister.cs
- ContractListAdapter.cs
- DataBindingCollectionEditor.cs
- XmlLanguage.cs
- InstancePersistenceCommand.cs
- LambdaCompiler.cs
- SafeHandles.cs
- Durable.cs
- QueueProcessor.cs
- Margins.cs
- PluralizationServiceUtil.cs
- ScriptManager.cs
- RenamedEventArgs.cs
- RectIndependentAnimationStorage.cs
- MetricEntry.cs
- Message.cs
- MenuItemAutomationPeer.cs
- X509Certificate2.cs
- StateBag.cs
- PersonalizationProviderCollection.cs
- EmulateRecognizeCompletedEventArgs.cs
- OuterGlowBitmapEffect.cs
- PackagePartCollection.cs
- CompoundFileStorageReference.cs
- FragmentQueryProcessor.cs
- QueryTask.cs
- ParseChildrenAsPropertiesAttribute.cs
- CharacterBufferReference.cs
- OutputCacheProfileCollection.cs
- PromptEventArgs.cs
- ToolCreatedEventArgs.cs
- DesignerActionPanel.cs
- DataServiceResponse.cs
- CollectionsUtil.cs
- EventTrigger.cs
- AmbientValueAttribute.cs
- ToolBar.cs
- IPGlobalProperties.cs
- TypeCodeDomSerializer.cs
- SpellerStatusTable.cs
- SerializerProvider.cs
- TrackBar.cs
- NameObjectCollectionBase.cs
- DynamicPropertyReader.cs
- SqlDataSourceCommandEventArgs.cs
- Timer.cs
- AsyncCompletedEventArgs.cs
- FormViewPagerRow.cs
- ReplacementText.cs
- XamlRtfConverter.cs
- CodeDomConfigurationHandler.cs
- NullExtension.cs
- ObjectCacheSettings.cs
- TableRow.cs
- EncryptedPackage.cs
- TdsParserHelperClasses.cs
- CultureSpecificStringDictionary.cs
- QilLoop.cs
- MimeMultiPart.cs
- CopyNamespacesAction.cs
- StateItem.cs
- HtmlElementErrorEventArgs.cs