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
- MemoryStream.cs
- MarkupCompiler.cs
- OrderToken.cs
- XmlNamespaceDeclarationsAttribute.cs
- BindingManagerDataErrorEventArgs.cs
- DataGridRowClipboardEventArgs.cs
- WhitespaceRuleLookup.cs
- iisPickupDirectory.cs
- Clause.cs
- GridViewHeaderRowPresenter.cs
- DetailsViewInsertedEventArgs.cs
- ProviderUtil.cs
- HMAC.cs
- WindowsListViewGroupHelper.cs
- ComplexLine.cs
- ContextConfiguration.cs
- XmlSchemaGroup.cs
- GeometryCollection.cs
- TypeTypeConverter.cs
- DTCTransactionManager.cs
- CodeSubDirectory.cs
- OdbcUtils.cs
- PrintDialogException.cs
- PartialTrustVisibleAssembly.cs
- HtmlWindowCollection.cs
- CollectionEditVerbManager.cs
- RSAOAEPKeyExchangeDeformatter.cs
- WebBaseEventKeyComparer.cs
- ObjectStorage.cs
- PenLineCapValidation.cs
- HighlightComponent.cs
- ValueQuery.cs
- DataBinder.cs
- TabItemWrapperAutomationPeer.cs
- BitmapData.cs
- Repeater.cs
- UnconditionalPolicy.cs
- HeaderElement.cs
- ProcessHostFactoryHelper.cs
- RIPEMD160Managed.cs
- WebBrowserPermission.cs
- SmtpNetworkElement.cs
- DataGridTablesFactory.cs
- WebEventCodes.cs
- TiffBitmapEncoder.cs
- AppDomainShutdownMonitor.cs
- BamlLocalizabilityResolver.cs
- DurationConverter.cs
- TextSerializer.cs
- DataGridTablesFactory.cs
- ConnectionOrientedTransportBindingElement.cs
- EdmToObjectNamespaceMap.cs
- TransformerInfoCollection.cs
- GridViewPageEventArgs.cs
- XmlNamespaceMapping.cs
- PropertyToken.cs
- MSAAWinEventWrap.cs
- SqlOuterApplyReducer.cs
- ServicePointManager.cs
- SqlLiftIndependentRowExpressions.cs
- Pair.cs
- CombinedGeometry.cs
- ListChangedEventArgs.cs
- SafeRightsManagementSessionHandle.cs
- InfoCardMasterKey.cs
- PnrpPeerResolverElement.cs
- Expander.cs
- TextInfo.cs
- NamespaceCollection.cs
- serverconfig.cs
- EntityClassGenerator.cs
- OracleColumn.cs
- ListBoxAutomationPeer.cs
- HandleExceptionArgs.cs
- OleDbReferenceCollection.cs
- util.cs
- FixedHighlight.cs
- PolyBezierSegment.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- VectorValueSerializer.cs
- RemoteWebConfigurationHostStream.cs
- Int32Converter.cs
- StatusBarAutomationPeer.cs
- EntityEntry.cs
- FigureParaClient.cs
- SecurityHeader.cs
- Missing.cs
- ShaderRenderModeValidation.cs
- IIS7UserPrincipal.cs
- Configuration.cs
- SignatureGenerator.cs
- ExpressionBinding.cs
- Stopwatch.cs
- VectorKeyFrameCollection.cs
- FontDialog.cs
- XmlSchemaObject.cs
- WebBrowserNavigatedEventHandler.cs
- MonthCalendar.cs
- WebPartRestoreVerb.cs
- NonParentingControl.cs