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
- ModulesEntry.cs
- ParserHooks.cs
- Point3D.cs
- FontStretches.cs
- SafeNativeMethods.cs
- PropertyNames.cs
- Stylesheet.cs
- Model3D.cs
- AppSettingsExpressionBuilder.cs
- SafeProcessHandle.cs
- SystemIcons.cs
- ComponentChangingEvent.cs
- Scheduler.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- Viewport3DAutomationPeer.cs
- PropertyDescriptors.cs
- Image.cs
- EntityWrapper.cs
- ProfileGroupSettingsCollection.cs
- AttributeSetAction.cs
- XamlInt32CollectionSerializer.cs
- ResourceContainerWrapper.cs
- HttpRuntimeSection.cs
- FormViewModeEventArgs.cs
- DataFieldConverter.cs
- MembershipUser.cs
- SqlBulkCopy.cs
- DrawingGroup.cs
- PageResolution.cs
- ResourceProviderFactory.cs
- AsyncContentLoadedEventArgs.cs
- PrinterResolution.cs
- Speller.cs
- AutomationProperties.cs
- XmlChildEnumerator.cs
- ToolZone.cs
- ToolZone.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- DateTimeFormat.cs
- RedirectionProxy.cs
- mediaeventshelper.cs
- CallbackHandler.cs
- FrameworkElement.cs
- UnsafeNativeMethodsPenimc.cs
- BuildManagerHost.cs
- ZipIOExtraFieldZip64Element.cs
- HtmlTextArea.cs
- OutputWindow.cs
- DataGridViewCheckBoxCell.cs
- ListViewDeletedEventArgs.cs
- SamlSubjectStatement.cs
- ProjectionAnalyzer.cs
- WindowsSidIdentity.cs
- ElementUtil.cs
- DataProtection.cs
- WorkflowWebService.cs
- WindowsListViewSubItem.cs
- DesignTimeVisibleAttribute.cs
- DynamicDiscoveryDocument.cs
- FlowDocumentFormatter.cs
- CodeBinaryOperatorExpression.cs
- TabRenderer.cs
- QilStrConcatenator.cs
- ParserContext.cs
- SvcMapFileLoader.cs
- BatchParser.cs
- DurationConverter.cs
- TypeDescriptionProvider.cs
- DBAsyncResult.cs
- RecordBuilder.cs
- LookupNode.cs
- SecurityPermission.cs
- InfoCardSymmetricAlgorithm.cs
- Exceptions.cs
- OracleRowUpdatingEventArgs.cs
- ResourcePermissionBase.cs
- TabControl.cs
- versioninfo.cs
- CustomPeerResolverService.cs
- XmlSchemaObjectTable.cs
- WebPartActionVerb.cs
- QuaternionAnimation.cs
- WorkflowServiceHost.cs
- ASCIIEncoding.cs
- DesignerVerb.cs
- MarkupCompilePass2.cs
- SecurityTokenException.cs
- ChannelProtectionRequirements.cs
- MemberAssignmentAnalysis.cs
- TableRowGroup.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- BindToObject.cs
- ExpressionStringBuilder.cs
- Currency.cs
- SimpleHandlerFactory.cs
- TextEditorLists.cs
- GeneralTransform3DGroup.cs
- StringPropertyBuilder.cs
- XmlObjectSerializerWriteContextComplex.cs
- UIElement.cs