Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- KeyBinding.cs
- GroupLabel.cs
- FlowDocumentView.cs
- TypeUnloadedException.cs
- AllMembershipCondition.cs
- LockedBorderGlyph.cs
- ConstructorNeedsTagAttribute.cs
- WindowsSlider.cs
- SQLUtility.cs
- ControlIdConverter.cs
- IPAddressCollection.cs
- ParenExpr.cs
- ObjectDataSourceSelectingEventArgs.cs
- LinearKeyFrames.cs
- InstanceData.cs
- CustomTokenProvider.cs
- CngKeyBlobFormat.cs
- GenericWebPart.cs
- MiniMapControl.xaml.cs
- DocumentOrderQuery.cs
- StatusBarItem.cs
- ThreadExceptionDialog.cs
- LinqDataSourceHelper.cs
- StringPropertyBuilder.cs
- CalendarKeyboardHelper.cs
- NavigationProgressEventArgs.cs
- ClientRoleProvider.cs
- HtmlElementErrorEventArgs.cs
- ServicePointManager.cs
- SmiGettersStream.cs
- ParserOptions.cs
- WsatExtendedInformation.cs
- PropertyInformationCollection.cs
- OleDbRowUpdatedEvent.cs
- RenderDataDrawingContext.cs
- DropShadowBitmapEffect.cs
- TraceUtils.cs
- InternalsVisibleToAttribute.cs
- ToolStripSeparatorRenderEventArgs.cs
- Span.cs
- EventRoute.cs
- ResourcePart.cs
- DesignerActionVerbItem.cs
- MouseEventArgs.cs
- QilLoop.cs
- XpsImage.cs
- ZipIOCentralDirectoryFileHeader.cs
- DoubleConverter.cs
- OptionUsage.cs
- HandleInitializationContext.cs
- OleDbDataAdapter.cs
- ListenerAdaptersInstallComponent.cs
- EnumUnknown.cs
- CmsInterop.cs
- SoapSchemaMember.cs
- ObjectViewFactory.cs
- ListViewInsertEventArgs.cs
- ReachDocumentPageSerializerAsync.cs
- WindowsListView.cs
- TreeView.cs
- BaseResourcesBuildProvider.cs
- baseshape.cs
- COM2ColorConverter.cs
- AssociationTypeEmitter.cs
- UrlMappingsModule.cs
- ArgumentOutOfRangeException.cs
- LayeredChannelListener.cs
- Rect3D.cs
- EventProviderWriter.cs
- PropertyInformation.cs
- SettingsPropertyWrongTypeException.cs
- ArraySegment.cs
- StringFreezingAttribute.cs
- CatalogPartChrome.cs
- RbTree.cs
- RemoteAsymmetricSignatureFormatter.cs
- RequestChannelBinder.cs
- DateTimeParse.cs
- XmlSchemaIdentityConstraint.cs
- VariantWrapper.cs
- WebBrowserNavigatingEventHandler.cs
- BaseTransportHeaders.cs
- UnescapedXmlDiagnosticData.cs
- EntityCollection.cs
- CellNormalizer.cs
- DataMisalignedException.cs
- DynamicPropertyHolder.cs
- Propagator.cs
- AssertUtility.cs
- AsyncResult.cs
- UnsafeNativeMethods.cs
- MultidimensionalArrayItemReference.cs
- XmlSerializerNamespaces.cs
- String.cs
- ScriptComponentDescriptor.cs
- InputScopeAttribute.cs
- EntityClassGenerator.cs
- DataPagerFieldCommandEventArgs.cs
- StyleHelper.cs
- ListManagerBindingsCollection.cs