Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / 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); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ //// 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DesignerAttribute.cs
- SqlGatherProducedAliases.cs
- DrawingDrawingContext.cs
- WebPartConnectionsConnectVerb.cs
- OraclePermissionAttribute.cs
- URI.cs
- keycontainerpermission.cs
- GeometryValueSerializer.cs
- FlowDocumentFormatter.cs
- SqlDependencyUtils.cs
- Section.cs
- GraphicsState.cs
- CLSCompliantAttribute.cs
- BitmapEffectDrawingContextWalker.cs
- wgx_commands.cs
- CheckBox.cs
- TemplateAction.cs
- SamlNameIdentifierClaimResource.cs
- SqlCacheDependency.cs
- RecognizedWordUnit.cs
- XmlDataLoader.cs
- IChannel.cs
- GroupBoxRenderer.cs
- PropertyChangeTracker.cs
- ManifestResourceInfo.cs
- IntSecurity.cs
- InvalidMessageContractException.cs
- RecommendedAsConfigurableAttribute.cs
- PrintPageEvent.cs
- TagMapInfo.cs
- FileCodeGroup.cs
- MarkupObject.cs
- TemplateEditingFrame.cs
- StandardToolWindows.cs
- ScaleTransform3D.cs
- StretchValidation.cs
- CacheChildrenQuery.cs
- TemplateField.cs
- ChangeDirector.cs
- ErrorRuntimeConfig.cs
- SHA512CryptoServiceProvider.cs
- SettingsPropertyValue.cs
- DateTimeOffsetStorage.cs
- Encoder.cs
- CodeTypeParameterCollection.cs
- InvalidProgramException.cs
- HighlightComponent.cs
- UriScheme.cs
- DPTypeDescriptorContext.cs
- ColumnHeaderConverter.cs
- ValueSerializer.cs
- StringWriter.cs
- EntityTypeEmitter.cs
- TraceHandler.cs
- RemoteWebConfigurationHostServer.cs
- BaseAsyncResult.cs
- AnnotationAuthorChangedEventArgs.cs
- MessageVersion.cs
- InstalledFontCollection.cs
- PropertyNames.cs
- CodeTryCatchFinallyStatement.cs
- ChtmlTextWriter.cs
- MetaModel.cs
- SQLBoolean.cs
- FontNamesConverter.cs
- SimpleFieldTemplateUserControl.cs
- ClientSession.cs
- DataColumnChangeEvent.cs
- Column.cs
- OleServicesContext.cs
- ADConnectionHelper.cs
- GridViewSortEventArgs.cs
- Opcode.cs
- SqlException.cs
- ColumnHeaderCollectionEditor.cs
- WebDisplayNameAttribute.cs
- ValidationEventArgs.cs
- AssociationSet.cs
- UdpTransportSettingsElement.cs
- DummyDataSource.cs
- DefaultSection.cs
- OSFeature.cs
- DerivedKeySecurityTokenStub.cs
- Clock.cs
- JournalEntry.cs
- Queue.cs
- RegistryPermission.cs
- COM2IProvidePropertyBuilderHandler.cs
- HttpWebRequest.cs
- ReferenceList.cs
- InputDevice.cs
- NameValueSectionHandler.cs
- MethodBuilderInstantiation.cs
- PropagatorResult.cs
- XamlPathDataSerializer.cs
- CompositeKey.cs
- StreamSecurityUpgradeInitiatorAsyncResult.cs
- ReachDocumentReferenceCollectionSerializerAsync.cs
- CodeDirectoryCompiler.cs
- SoapAttributeOverrides.cs