Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / xsp / System / Web / UI / WebControls / StringArrayConverter.cs / 1 / 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. // //----------------------------------------------------------------------------- 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DockAndAnchorLayout.cs
- VisualBrush.cs
- XMLUtil.cs
- RuleInfoComparer.cs
- UnsafeNativeMethodsTablet.cs
- LogicalExpr.cs
- VScrollProperties.cs
- BypassElement.cs
- DataGridCommandEventArgs.cs
- XmlSiteMapProvider.cs
- Themes.cs
- XsdCachingReader.cs
- XmlChildNodes.cs
- ToolStripControlHost.cs
- WsdlInspector.cs
- User.cs
- ErrorTableItemStyle.cs
- Transactions.cs
- ObjectStateEntry.cs
- ContentOperations.cs
- ButtonField.cs
- ParsedRoute.cs
- RemoteWebConfigurationHostServer.cs
- ToolBar.cs
- HtmlImage.cs
- XmlTextReaderImpl.cs
- CaseInsensitiveOrdinalStringComparer.cs
- Brush.cs
- SendMessageRecord.cs
- XPathNavigator.cs
- BidPrivateBase.cs
- EditorZone.cs
- DataGridViewSelectedColumnCollection.cs
- MetadataArtifactLoader.cs
- TreeNodeSelectionProcessor.cs
- indexingfiltermarshaler.cs
- Compiler.cs
- SmtpMail.cs
- SkewTransform.cs
- DesignerAutoFormat.cs
- XmlHierarchyData.cs
- SqlSelectStatement.cs
- CompiledELinqQueryState.cs
- __FastResourceComparer.cs
- SqlUtils.cs
- InstanceView.cs
- ToolStripRenderer.cs
- ResourcesChangeInfo.cs
- BehaviorEditorPart.cs
- ToolTip.cs
- ObjectQuery_EntitySqlExtensions.cs
- SchemaElementLookUpTableEnumerator.cs
- OutputCacheSection.cs
- ThreadStateException.cs
- ContentPropertyAttribute.cs
- StateWorkerRequest.cs
- SelectionHighlightInfo.cs
- ConstructorExpr.cs
- InputLanguageProfileNotifySink.cs
- ViewgenGatekeeper.cs
- RowsCopiedEventArgs.cs
- Vertex.cs
- WebColorConverter.cs
- PerformanceCountersElement.cs
- ExpandableObjectConverter.cs
- LicenseContext.cs
- TabControl.cs
- ToolboxCategory.cs
- XPathPatternBuilder.cs
- CompModSwitches.cs
- ContainerParagraph.cs
- GridViewCommandEventArgs.cs
- NonVisualControlAttribute.cs
- TypeHelpers.cs
- D3DImage.cs
- LineGeometry.cs
- EntityDataSourceDesigner.cs
- SequentialUshortCollection.cs
- MultiBindingExpression.cs
- _TransmitFileOverlappedAsyncResult.cs
- HttpDebugHandler.cs
- CodeBlockBuilder.cs
- SettingsAttributeDictionary.cs
- FigureParagraph.cs
- StringValidator.cs
- ControlTemplate.cs
- BindingFormattingDialog.cs
- Compilation.cs
- Color.cs
- ActivityTypeResolver.xaml.cs
- SessionPageStatePersister.cs
- SQLBytesStorage.cs
- PropertyMetadata.cs
- SequenceQuery.cs
- CodeSubDirectory.cs
- ContentTextAutomationPeer.cs
- DbConvert.cs
- TextSearch.cs
- CommandHelpers.cs
- ExecutedRoutedEventArgs.cs