Code:
/ DotNET / DotNET / 8.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
- ObjectDesignerDataSourceView.cs
- OledbConnectionStringbuilder.cs
- ToolBarTray.cs
- HijriCalendar.cs
- BlockExpression.cs
- Line.cs
- FileIOPermission.cs
- CriticalFinalizerObject.cs
- VirtualPath.cs
- AutoScrollExpandMessageFilter.cs
- HMACSHA512.cs
- DependencyObjectType.cs
- Typography.cs
- NumberFormatInfo.cs
- ConcurrentStack.cs
- ProjectionAnalyzer.cs
- PenThreadPool.cs
- PipelineModuleStepContainer.cs
- RawStylusInputCustomData.cs
- sqlmetadatafactory.cs
- CacheHelper.cs
- TrackingExtract.cs
- SqlDataSourceAdvancedOptionsForm.cs
- WebBrowser.cs
- XmlSerializerSection.cs
- ImmutableDispatchRuntime.cs
- XmlILAnnotation.cs
- AutomationPropertyInfo.cs
- KnownTypesHelper.cs
- RenderCapability.cs
- RtfToXamlReader.cs
- ResourceExpressionBuilder.cs
- StringHelper.cs
- XmlTextReaderImplHelpers.cs
- LoginStatusDesigner.cs
- TextServicesManager.cs
- ValidationErrorInfo.cs
- BitmapFrameEncode.cs
- CqlLexer.cs
- OperationInfoBase.cs
- _AuthenticationState.cs
- Shape.cs
- TemplateParser.cs
- SecurityContext.cs
- StackBuilderSink.cs
- ImageFormatConverter.cs
- UniqueConstraint.cs
- TabControlCancelEvent.cs
- COM2AboutBoxPropertyDescriptor.cs
- ResourcePool.cs
- RootBrowserWindowAutomationPeer.cs
- JsonFormatReaderGenerator.cs
- DocumentViewerAutomationPeer.cs
- DataGridCheckBoxColumn.cs
- ConfigXmlReader.cs
- XmlTypeMapping.cs
- TextBounds.cs
- CreateUserWizardStep.cs
- Control.cs
- AssertFilter.cs
- HebrewNumber.cs
- XmlSchemaSimpleType.cs
- AutomationAttributeInfo.cs
- SqlProfileProvider.cs
- RuleRefElement.cs
- InputScope.cs
- SortDescription.cs
- CompilerInfo.cs
- UnknownWrapper.cs
- CancellationTokenSource.cs
- AncillaryOps.cs
- EdmItemError.cs
- CursorInteropHelper.cs
- SignedPkcs7.cs
- LoginView.cs
- ClaimTypes.cs
- ServiceNameCollection.cs
- TextPenaltyModule.cs
- HostedElements.cs
- QueryComponents.cs
- ScriptRef.cs
- TextCollapsingProperties.cs
- OneOfElement.cs
- LoginView.cs
- ExpressionBindingCollection.cs
- nulltextcontainer.cs
- M3DUtil.cs
- FragmentQueryKB.cs
- XPathNavigatorException.cs
- InteropExecutor.cs
- CompilationLock.cs
- __ComObject.cs
- IgnoreSectionHandler.cs
- DefaultTypeArgumentAttribute.cs
- BasicCommandTreeVisitor.cs
- DataGridViewControlCollection.cs
- DiscoveryReference.cs
- StylusDownEventArgs.cs
- DateTimeOffsetStorage.cs
- SimpleWorkerRequest.cs