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
- PriorityBinding.cs
- RNGCryptoServiceProvider.cs
- TagPrefixInfo.cs
- Vector.cs
- DataRow.cs
- AssemblyNameUtility.cs
- TrackingProfileCache.cs
- XmlAnyAttributeAttribute.cs
- CompositionDesigner.cs
- PeerToPeerException.cs
- CryptoKeySecurity.cs
- sortedlist.cs
- WindowsGraphicsWrapper.cs
- bindurihelper.cs
- DataGridColumnCollectionEditor.cs
- ViewBase.cs
- ImportContext.cs
- TextEffectCollection.cs
- InvokeMethod.cs
- IInstanceTable.cs
- ApplicationSecurityInfo.cs
- TaskHelper.cs
- SortDescription.cs
- SqlDataSourceCache.cs
- IFlowDocumentViewer.cs
- CngProvider.cs
- QueryTask.cs
- _NegotiateClient.cs
- UserMapPath.cs
- StrokeSerializer.cs
- VectorValueSerializer.cs
- ResolveMatchesCD1.cs
- invalidudtexception.cs
- ToggleProviderWrapper.cs
- TypeSystemHelpers.cs
- ImplicitInputBrush.cs
- ClientRoleProvider.cs
- XamlSerializationHelper.cs
- PathGeometry.cs
- DataGridViewAdvancedBorderStyle.cs
- UrlPath.cs
- ExecutionContext.cs
- MD5CryptoServiceProvider.cs
- Keyboard.cs
- MarshalDirectiveException.cs
- ContextMenuStrip.cs
- CapabilitiesState.cs
- WebPartHeaderCloseVerb.cs
- SafeReadContext.cs
- ManifestBasedResourceGroveler.cs
- SymLanguageType.cs
- TemplateNameScope.cs
- VectorAnimation.cs
- BooleanProjectedSlot.cs
- ToolStripItemRenderEventArgs.cs
- IndexedEnumerable.cs
- SqlConnectionManager.cs
- HyperLinkColumn.cs
- DataGridViewLinkColumn.cs
- DrawingAttributesDefaultValueFactory.cs
- Schedule.cs
- Soap.cs
- HtmlInputHidden.cs
- GeneratedCodeAttribute.cs
- DayRenderEvent.cs
- SpnegoTokenAuthenticator.cs
- EditingCoordinator.cs
- CodePageUtils.cs
- LayoutUtils.cs
- StructuralObject.cs
- GetPageCompletedEventArgs.cs
- SqlTriggerAttribute.cs
- PageCache.cs
- ProfileSettings.cs
- RegexGroup.cs
- TextEditorLists.cs
- OdbcDataAdapter.cs
- Enum.cs
- Stopwatch.cs
- LineProperties.cs
- Module.cs
- PartitionResolver.cs
- CompModSwitches.cs
- ObjectDataSourceView.cs
- XsdSchemaFileEditor.cs
- SystemSounds.cs
- MenuTracker.cs
- WebBrowserNavigatingEventHandler.cs
- RoleManagerModule.cs
- BitConverter.cs
- ArrangedElementCollection.cs
- UserControlCodeDomTreeGenerator.cs
- Bidi.cs
- SystemIcmpV4Statistics.cs
- TableParaClient.cs
- DelegateSerializationHolder.cs
- ConfigDefinitionUpdates.cs
- ObjectDataSourceSelectingEventArgs.cs
- WmiInstallComponent.cs
- TextEffect.cs