Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / 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. //------------------------------------------------------------------------------ //// 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
- InputManager.cs
- WebPartConnectionsConfigureVerb.cs
- Int64.cs
- Bits.cs
- DefaultAsyncDataDispatcher.cs
- FilteredDataSetHelper.cs
- RemotingException.cs
- SimpleHandlerFactory.cs
- TextEditorContextMenu.cs
- UserPersonalizationStateInfo.cs
- MDIControlStrip.cs
- MetabaseSettingsIis7.cs
- ButtonRenderer.cs
- ConfigurationSectionGroup.cs
- ClientData.cs
- TreeBuilder.cs
- ScrollEventArgs.cs
- ScriptDescriptor.cs
- ListControlBoundActionList.cs
- XmlMemberMapping.cs
- PauseStoryboard.cs
- Control.cs
- FlowPosition.cs
- WindowsListViewScroll.cs
- CommandEventArgs.cs
- ContentType.cs
- TrackPointCollection.cs
- SchemaImporterExtensionElement.cs
- autovalidator.cs
- GcHandle.cs
- Operator.cs
- DataSpaceManager.cs
- HandlerMappingMemo.cs
- WebPartsSection.cs
- ColorMatrix.cs
- altserialization.cs
- Popup.cs
- GeneralTransform2DTo3D.cs
- IdentityNotMappedException.cs
- SystemMulticastIPAddressInformation.cs
- IndexOutOfRangeException.cs
- PipeSecurity.cs
- mansign.cs
- GroupByExpressionRewriter.cs
- Task.cs
- SweepDirectionValidation.cs
- FlowDocumentFormatter.cs
- DesignerTextBoxAdapter.cs
- User.cs
- DefaultConfirmation.cs
- UpnEndpointIdentity.cs
- ServiceModelEnumValidator.cs
- PolicyChain.cs
- SafeRightsManagementSessionHandle.cs
- GridViewRowCollection.cs
- CurrentChangingEventManager.cs
- FrameworkElementAutomationPeer.cs
- FunctionDescription.cs
- Rotation3DKeyFrameCollection.cs
- IsolatedStoragePermission.cs
- StrongNamePublicKeyBlob.cs
- CodeNamespaceImportCollection.cs
- TypeUsageBuilder.cs
- BrowserDefinition.cs
- SelectionRangeConverter.cs
- MetadataCacheItem.cs
- CapacityStreamGeometryContext.cs
- StatusBarPanelClickEvent.cs
- TokenFactoryCredential.cs
- BindingListCollectionView.cs
- HashCoreRequest.cs
- SingleConverter.cs
- _BaseOverlappedAsyncResult.cs
- PagerSettings.cs
- FixedSOMLineRanges.cs
- IsolatedStorageException.cs
- SymbolMethod.cs
- NameHandler.cs
- TripleDES.cs
- Dispatcher.cs
- TypeUsage.cs
- BufferedGraphicsManager.cs
- ListView.cs
- SqlGatherConsumedAliases.cs
- GuidelineCollection.cs
- RequestCachePolicy.cs
- ResXDataNode.cs
- TextureBrush.cs
- WindowsFormsLinkLabel.cs
- Selection.cs
- AlternateView.cs
- ListViewEditEventArgs.cs
- SafeHandles.cs
- OptimizerPatterns.cs
- SqlSelectStatement.cs
- ToolStripGripRenderEventArgs.cs
- ConsoleCancelEventArgs.cs
- CacheMode.cs
- AutomationElementCollection.cs
- RegexInterpreter.cs