Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- httpapplicationstate.cs
- ToolStripItemCollection.cs
- LocationReference.cs
- ViewBase.cs
- TransactionInformation.cs
- DesignerVerbCollection.cs
- FormsAuthenticationUser.cs
- PlainXmlDeserializer.cs
- TextElementEnumerator.cs
- HierarchicalDataSourceControl.cs
- FormViewPageEventArgs.cs
- ImageSourceConverter.cs
- BoundPropertyEntry.cs
- PassportAuthenticationModule.cs
- SharedTcpTransportManager.cs
- SchemaImporterExtensionsSection.cs
- XsltCompileContext.cs
- IISUnsafeMethods.cs
- InstalledFontCollection.cs
- EnumConverter.cs
- sortedlist.cs
- SizeConverter.cs
- DataSourceCache.cs
- QuaternionConverter.cs
- KernelTypeValidation.cs
- followingsibling.cs
- DataTableNewRowEvent.cs
- PrintPreviewControl.cs
- TypeExtensionConverter.cs
- KeyedPriorityQueue.cs
- LinkConverter.cs
- FormatterConverter.cs
- PassportIdentity.cs
- IntegerValidator.cs
- FileReservationCollection.cs
- EdmSchemaAttribute.cs
- XmlSchemaAttributeGroup.cs
- DetailsViewDeleteEventArgs.cs
- RegexInterpreter.cs
- TypeUtils.cs
- WebPartEventArgs.cs
- URLAttribute.cs
- GPPOINTF.cs
- AdornedElementPlaceholder.cs
- SmiConnection.cs
- LinkLabelLinkClickedEvent.cs
- HotCommands.cs
- TokenizerHelper.cs
- DesignerVerbToolStripMenuItem.cs
- Repeater.cs
- SectionInformation.cs
- SmiTypedGetterSetter.cs
- DataContract.cs
- DBConnection.cs
- DataGridViewCheckBoxCell.cs
- CfgRule.cs
- ResourceDefaultValueAttribute.cs
- NativeMethods.cs
- XsdBuilder.cs
- DeploymentSection.cs
- dtdvalidator.cs
- HttpProcessUtility.cs
- RequestCache.cs
- ObjectViewQueryResultData.cs
- OperationFormatStyle.cs
- CodeGenerator.cs
- PathTooLongException.cs
- DesignerActionHeaderItem.cs
- RoutedPropertyChangedEventArgs.cs
- AuthenticationConfig.cs
- LinkConverter.cs
- TemplatedMailWebEventProvider.cs
- TextRangeEditLists.cs
- SHA512.cs
- SafeNativeMethods.cs
- InkCanvasFeedbackAdorner.cs
- PaintValueEventArgs.cs
- RedistVersionInfo.cs
- ProviderConnectionPoint.cs
- KeyInfo.cs
- CompilerInfo.cs
- WebConvert.cs
- TableParagraph.cs
- MaxValueConverter.cs
- CustomCredentialPolicy.cs
- DataGridDesigner.cs
- CounterCreationDataCollection.cs
- XamlBrushSerializer.cs
- WebDescriptionAttribute.cs
- DataGridViewTopRowAccessibleObject.cs
- AttachedPropertyMethodSelector.cs
- ConstructorArgumentAttribute.cs
- StreamingContext.cs
- SoapSchemaImporter.cs
- ErrorsHelper.cs
- TraceLog.cs
- FormClosedEvent.cs
- HMACMD5.cs
- IgnoreFlushAndCloseStream.cs
- CollectionType.cs