Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / xsp / System / Web / UI / WebControls / StringArrayConverter.cs / 1 / 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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ApplicationActivator.cs
- XmlTextReader.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- MobileControlsSectionHandler.cs
- CurrentTimeZone.cs
- CheckBoxAutomationPeer.cs
- UrlMappingCollection.cs
- XmlNodeWriter.cs
- OdbcErrorCollection.cs
- DataGridViewComboBoxCell.cs
- ViewManagerAttribute.cs
- DesignerActionListCollection.cs
- _AuthenticationState.cs
- RegistryPermission.cs
- WorkflowValidationFailedException.cs
- RayHitTestParameters.cs
- EventLogEntryCollection.cs
- HtmlInputImage.cs
- AssemblyAssociatedContentFileAttribute.cs
- BinaryCommonClasses.cs
- SingletonChannelAcceptor.cs
- sitestring.cs
- RequestQueue.cs
- TextEditor.cs
- TemplateEditingFrame.cs
- RowUpdatedEventArgs.cs
- EDesignUtil.cs
- ContextStaticAttribute.cs
- AffineTransform3D.cs
- ChineseLunisolarCalendar.cs
- TreeViewImageKeyConverter.cs
- ContentPropertyAttribute.cs
- SplitterCancelEvent.cs
- PropertyMetadata.cs
- SQLGuid.cs
- CommandEventArgs.cs
- Light.cs
- ColorDialog.cs
- EditingCoordinator.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- ProviderSettings.cs
- ScrollPatternIdentifiers.cs
- UpDownEvent.cs
- ArraySegment.cs
- GeneralTransform2DTo3D.cs
- DirectoryNotFoundException.cs
- BooleanFacetDescriptionElement.cs
- SimpleBitVector32.cs
- SamlAuthorityBinding.cs
- XmlWrappingWriter.cs
- DataGrid.cs
- ItemDragEvent.cs
- IndexedDataBuffer.cs
- Light.cs
- ExtensionSimplifierMarkupObject.cs
- CellParagraph.cs
- Track.cs
- RequestStatusBarUpdateEventArgs.cs
- shaperfactoryquerycacheentry.cs
- xsdvalidator.cs
- GradientStop.cs
- XXXInfos.cs
- StringAnimationBase.cs
- FileChangeNotifier.cs
- XmlParser.cs
- SchemaCreator.cs
- MimeTypeAttribute.cs
- OpacityConverter.cs
- ExpressionEditorAttribute.cs
- ProviderCollection.cs
- UriTemplateDispatchFormatter.cs
- ScrollEventArgs.cs
- HttpWebRequestElement.cs
- Repeater.cs
- DynamicQueryableWrapper.cs
- SQLInt32Storage.cs
- BindingContext.cs
- Internal.cs
- ReachDocumentPageSerializerAsync.cs
- MsmqMessageSerializationFormat.cs
- CallSiteHelpers.cs
- IArgumentProvider.cs
- DataBindingCollection.cs
- DocumentManager.cs
- ReliableMessagingVersionConverter.cs
- ReachFixedPageSerializerAsync.cs
- ContractMapping.cs
- AttributeTableBuilder.cs
- Transform3D.cs
- WebPermission.cs
- Socket.cs
- HandlerMappingMemo.cs
- MonitoringDescriptionAttribute.cs
- PropertyToken.cs
- UnsafeNativeMethods.cs
- SoapAttributes.cs
- PrinterResolution.cs
- Utils.cs
- TemplateComponentConnector.cs
- KerberosSecurityTokenAuthenticator.cs