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
- MetadataArtifactLoaderXmlReaderWrapper.cs
- ToolBarPanel.cs
- TraceEventCache.cs
- XPathBinder.cs
- RootBuilder.cs
- filewebresponse.cs
- BinaryWriter.cs
- InstanceLockQueryResult.cs
- BrowserCapabilitiesFactoryBase.cs
- WrappedKeySecurityToken.cs
- DeclarationUpdate.cs
- StateMachineAction.cs
- CodeConstructor.cs
- CookieParameter.cs
- CapacityStreamGeometryContext.cs
- HtmlInputCheckBox.cs
- CommandLineParser.cs
- UIElementParagraph.cs
- XmlReflectionMember.cs
- PolyBezierSegmentFigureLogic.cs
- MessageFormatterConverter.cs
- XPathExpr.cs
- UnsafeNativeMethods.cs
- SelectedGridItemChangedEvent.cs
- WorkflowRuntime.cs
- _HeaderInfo.cs
- SoapFaultCodes.cs
- WorkflowStateRollbackService.cs
- WebPartConnectionsCancelEventArgs.cs
- ReferencedAssemblyResolver.cs
- InteropAutomationProvider.cs
- BitmapMetadataBlob.cs
- BuildProviderUtils.cs
- TextEmbeddedObject.cs
- ControlType.cs
- ImmutableObjectAttribute.cs
- TextViewBase.cs
- Environment.cs
- Encoding.cs
- RC2.cs
- FastEncoderWindow.cs
- InputScopeConverter.cs
- cookiecollection.cs
- SafeLibraryHandle.cs
- DesignerTransaction.cs
- QueryOperationResponseOfT.cs
- SystemResourceHost.cs
- CompiledQuery.cs
- SafeProcessHandle.cs
- Types.cs
- EqualityArray.cs
- safelink.cs
- PathParser.cs
- WSMessageEncoding.cs
- CompositeDataBoundControl.cs
- BaseParagraph.cs
- X509CertificateCollection.cs
- TdsParserSafeHandles.cs
- _CookieModule.cs
- MimeReturn.cs
- MSHTMLHost.cs
- FormView.cs
- IsolatedStoragePermission.cs
- AssemblyName.cs
- ProfileEventArgs.cs
- Expressions.cs
- SerializationStore.cs
- DPCustomTypeDescriptor.cs
- HtmlInputReset.cs
- ServiceProviders.cs
- RSAOAEPKeyExchangeFormatter.cs
- AttachmentCollection.cs
- Validator.cs
- RequiredFieldValidator.cs
- ICspAsymmetricAlgorithm.cs
- ProbeMatchesApril2005.cs
- UserControlBuildProvider.cs
- SQLBytes.cs
- Contracts.cs
- ConfigXmlSignificantWhitespace.cs
- WindowsFormsDesignerOptionService.cs
- ReliableOutputConnection.cs
- StrokeDescriptor.cs
- ExpressionEvaluator.cs
- NamedPipeTransportBindingElement.cs
- DecimalAnimationUsingKeyFrames.cs
- JapaneseLunisolarCalendar.cs
- Blend.cs
- BitmapMetadataEnumerator.cs
- ReferencedType.cs
- TypefaceCollection.cs
- UdpDiscoveryMessageFilter.cs
- RightsManagementPermission.cs
- XsltConvert.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- RegistrationServices.cs
- SlotInfo.cs
- clipboard.cs
- ListViewItem.cs
- CultureTableRecord.cs