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
- XmlResolver.cs
- DesignerAdRotatorAdapter.cs
- DataObject.cs
- PropertyPathWorker.cs
- PlainXmlWriter.cs
- StorageFunctionMapping.cs
- FormViewRow.cs
- TraceFilter.cs
- TrustLevelCollection.cs
- WebControl.cs
- ApplicationManager.cs
- DbConnectionOptions.cs
- BinaryNode.cs
- DataGridDetailsPresenter.cs
- PasswordPropertyTextAttribute.cs
- GroupLabel.cs
- _SpnDictionary.cs
- DataSourceXmlSerializer.cs
- Inline.cs
- HTTPNotFoundHandler.cs
- Divide.cs
- SchemaCollectionPreprocessor.cs
- EngineSiteSapi.cs
- SqlFileStream.cs
- ClassHandlersStore.cs
- ClientTargetCollection.cs
- GenericPrincipal.cs
- RectAnimationClockResource.cs
- ClientSideProviderDescription.cs
- PrintDocument.cs
- WebPartUtil.cs
- RSAPKCS1SignatureDeformatter.cs
- AutoScrollHelper.cs
- XmlLanguageConverter.cs
- HashCodeCombiner.cs
- QilExpression.cs
- GraphicsPath.cs
- WeakReadOnlyCollection.cs
- PathFigure.cs
- DataContractSerializerOperationBehavior.cs
- BufferedGraphicsManager.cs
- SystemEvents.cs
- autovalidator.cs
- VerifyHashRequest.cs
- Journaling.cs
- CustomValidator.cs
- CustomGrammar.cs
- SmiEventSink_DeferedProcessing.cs
- XmlSchemaAnnotated.cs
- BuildResultCache.cs
- TrackingWorkflowEventArgs.cs
- CompiledRegexRunnerFactory.cs
- EdmPropertyAttribute.cs
- XmlnsCache.cs
- PerfCounterSection.cs
- TdsParserSessionPool.cs
- LogicalExpr.cs
- XmlNamespaceMapping.cs
- HiddenField.cs
- WebFaultClientMessageInspector.cs
- WorkflowHostingEndpoint.cs
- InputLanguageCollection.cs
- DotExpr.cs
- DocumentViewerHelper.cs
- PeerApplication.cs
- MessageQueueKey.cs
- ProfileBuildProvider.cs
- VerificationException.cs
- FormatterConverter.cs
- OleDbRowUpdatingEvent.cs
- MonikerSyntaxException.cs
- CallbackValidatorAttribute.cs
- Partitioner.cs
- PenContexts.cs
- DataControlButton.cs
- ConstraintStruct.cs
- SqlDataSourceCommandParser.cs
- figurelengthconverter.cs
- DrawingBrush.cs
- ImplicitInputBrush.cs
- HttpConfigurationContext.cs
- PathFigureCollectionConverter.cs
- ExpandCollapseProviderWrapper.cs
- nulltextcontainer.cs
- SQLBytes.cs
- EDesignUtil.cs
- Win32PrintDialog.cs
- FixedDocumentSequencePaginator.cs
- AspNetSynchronizationContext.cs
- BCLDebug.cs
- SqlMetaData.cs
- StructuredType.cs
- BuildProviderAppliesToAttribute.cs
- login.cs
- XmlSerializerAssemblyAttribute.cs
- ProjectionPruner.cs
- IncrementalCompileAnalyzer.cs
- DecimalConverter.cs
- MethodCallConverter.cs
- ImageClickEventArgs.cs