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
- Number.cs
- LoginCancelEventArgs.cs
- ZipIOCentralDirectoryFileHeader.cs
- PreviewControlDesigner.cs
- BackgroundWorker.cs
- SiteMapProvider.cs
- CommunicationObjectManager.cs
- XpsDigitalSignature.cs
- ActivitySurrogate.cs
- DataGridViewCellContextMenuStripNeededEventArgs.cs
- PerfCounterSection.cs
- KeyedQueue.cs
- RoleGroupCollection.cs
- PageAsyncTaskManager.cs
- StandardToolWindows.cs
- CommonObjectSecurity.cs
- HelpEvent.cs
- SqlRecordBuffer.cs
- CipherData.cs
- InputBuffer.cs
- IriParsingElement.cs
- Stroke.cs
- SizeKeyFrameCollection.cs
- NumericPagerField.cs
- PeerCustomResolverElement.cs
- ComponentChangingEvent.cs
- DataList.cs
- SingleAnimationUsingKeyFrames.cs
- IPPacketInformation.cs
- RangeValueProviderWrapper.cs
- Encoding.cs
- EnterpriseServicesHelper.cs
- GeneralTransform2DTo3DTo2D.cs
- unsafenativemethodstextservices.cs
- ExcCanonicalXml.cs
- TextProperties.cs
- ResourceSetExpression.cs
- SponsorHelper.cs
- HTTPNotFoundHandler.cs
- oledbconnectionstring.cs
- GreenMethods.cs
- SelectionService.cs
- Mapping.cs
- SqlEnums.cs
- TreeIterator.cs
- ProfileInfo.cs
- RunClient.cs
- XPathDocumentBuilder.cs
- RubberbandSelector.cs
- Application.cs
- _ListenerResponseStream.cs
- AlignmentYValidation.cs
- PieceNameHelper.cs
- CheckBoxList.cs
- ScrollableControl.cs
- SqlComparer.cs
- DateBoldEvent.cs
- listitem.cs
- Version.cs
- SapiGrammar.cs
- RepeaterCommandEventArgs.cs
- Crc32Helper.cs
- ReadOnlyObservableCollection.cs
- ClientConfigPaths.cs
- ConfigurationManagerInternalFactory.cs
- SchemaCollectionCompiler.cs
- Ray3DHitTestResult.cs
- XmlSchemaSimpleContentExtension.cs
- BamlBinaryWriter.cs
- KeySplineConverter.cs
- GPPOINTF.cs
- SafePEFileHandle.cs
- GC.cs
- DurationConverter.cs
- AxHost.cs
- FixedFlowMap.cs
- FrameworkRichTextComposition.cs
- AnyAllSearchOperator.cs
- InkCanvasSelectionAdorner.cs
- DriveNotFoundException.cs
- PolicyManager.cs
- ScriptingProfileServiceSection.cs
- XamlToRtfWriter.cs
- Formatter.cs
- CqlParser.cs
- ProxyGenerationError.cs
- SchemaType.cs
- PageAsyncTask.cs
- SpeakInfo.cs
- MailAddress.cs
- DataContractSet.cs
- Figure.cs
- SQLBinary.cs
- DependencyPropertyKey.cs
- DataGridItemEventArgs.cs
- DependencyProperty.cs
- WebPartEventArgs.cs
- PrintDocument.cs
- ProviderUtil.cs
- TemplateBindingExtension.cs