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
- SqlInternalConnection.cs
- ClientEndpointLoader.cs
- PathFigureCollectionConverter.cs
- PagesSection.cs
- HMAC.cs
- SslStream.cs
- CompositeDataBoundControl.cs
- HttpContext.cs
- TransactionContextValidator.cs
- XmlSerializerFactory.cs
- WbemException.cs
- FixedHighlight.cs
- CodeGen.cs
- TextSpanModifier.cs
- ObjectDataSourceDisposingEventArgs.cs
- EntityContainerEntitySet.cs
- PropertyPathConverter.cs
- EntityCommandDefinition.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- VectorCollectionConverter.cs
- Assert.cs
- Pointer.cs
- SeekStoryboard.cs
- tibetanshape.cs
- CompiledELinqQueryState.cs
- SID.cs
- FileStream.cs
- ListControlDesigner.cs
- PolicyManager.cs
- TraversalRequest.cs
- backend.cs
- BlobPersonalizationState.cs
- TypeGeneratedEventArgs.cs
- SplitterEvent.cs
- rsa.cs
- OdbcInfoMessageEvent.cs
- SmtpAuthenticationManager.cs
- ChangeNode.cs
- SqlNotificationRequest.cs
- MenuTracker.cs
- TableItemPatternIdentifiers.cs
- _ConnectStream.cs
- XamlDesignerSerializationManager.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- DataGridViewCellStyleConverter.cs
- Content.cs
- XmlSerializableServices.cs
- RegistryPermission.cs
- DefaultWorkflowTransactionService.cs
- NavigationService.cs
- UnaryExpression.cs
- WorkflowQueueInfo.cs
- ListenUriMode.cs
- DefaultParameterValueAttribute.cs
- CornerRadiusConverter.cs
- AssemblyBuilder.cs
- WmlValidationSummaryAdapter.cs
- MetadataArtifactLoaderCompositeFile.cs
- DocumentScope.cs
- RemotingHelper.cs
- TransformValueSerializer.cs
- DesignBindingEditor.cs
- IsolatedStorageFilePermission.cs
- CodeMethodReturnStatement.cs
- PlatformNotSupportedException.cs
- Stacktrace.cs
- ActivityTypeDesigner.xaml.cs
- ThaiBuddhistCalendar.cs
- DataGridViewColumnConverter.cs
- SrgsSubset.cs
- XmlIncludeAttribute.cs
- TextEffectResolver.cs
- SecurityTokenAuthenticator.cs
- _RequestCacheProtocol.cs
- TextServicesDisplayAttribute.cs
- ExpandSegment.cs
- KeyGesture.cs
- SQLMembershipProvider.cs
- BindingNavigator.cs
- SqlLiftIndependentRowExpressions.cs
- IntegrationExceptionEventArgs.cs
- ButtonBase.cs
- ViewManager.cs
- loginstatus.cs
- JulianCalendar.cs
- UserPreferenceChangedEventArgs.cs
- QueryOutputWriter.cs
- PersistenceTask.cs
- ToolboxItemCollection.cs
- handlecollector.cs
- MeasurementDCInfo.cs
- ClientBase.cs
- SmiTypedGetterSetter.cs
- WebPageTraceListener.cs
- CodeTypeConstructor.cs
- datacache.cs
- HealthMonitoringSection.cs
- DocumentSchemaValidator.cs
- DocumentSequence.cs
- DelegateCompletionCallbackWrapper.cs