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
- MissingMethodException.cs
- RemotingSurrogateSelector.cs
- OdbcEnvironmentHandle.cs
- FilteredSchemaElementLookUpTable.cs
- ClientEventManager.cs
- GenericsInstances.cs
- ReaderOutput.cs
- DiscoveryServerProtocol.cs
- QilDataSource.cs
- Int16Converter.cs
- Button.cs
- TransformedBitmap.cs
- ThreadStaticAttribute.cs
- ItemPager.cs
- RegexInterpreter.cs
- TextEditorMouse.cs
- TextEndOfSegment.cs
- XmlComplianceUtil.cs
- ReaderWriterLockWrapper.cs
- ListViewGroup.cs
- PresentationSource.cs
- CodeExpressionCollection.cs
- Clock.cs
- SafeHGlobalHandleCritical.cs
- ColumnHeader.cs
- EmptyStringExpandableObjectConverter.cs
- Opcode.cs
- PropertyGridView.cs
- BitmapEffectInput.cs
- FontStretch.cs
- Latin1Encoding.cs
- Matrix3DConverter.cs
- ProviderConnectionPoint.cs
- RootBrowserWindow.cs
- PartBasedPackageProperties.cs
- RangeBase.cs
- ListItemConverter.cs
- ConfigViewGenerator.cs
- DBProviderConfigurationHandler.cs
- Hex.cs
- TypeHelper.cs
- BasePropertyDescriptor.cs
- TypeDefinition.cs
- SystemResourceHost.cs
- EngineSiteSapi.cs
- WindowsListViewItemStartMenu.cs
- StatusBarPanel.cs
- CompositeDataBoundControl.cs
- HttpEncoder.cs
- VScrollBar.cs
- Margins.cs
- AliasedSlot.cs
- SafeMILHandle.cs
- WorkflowEnvironment.cs
- MessageQuerySet.cs
- TextClipboardData.cs
- SamlNameIdentifierClaimResource.cs
- XmlSchemaAnnotation.cs
- LinkDescriptor.cs
- MissingMethodException.cs
- SamlEvidence.cs
- Matrix3D.cs
- SimpleType.cs
- QualifiedCellIdBoolean.cs
- OptionalRstParameters.cs
- LongSumAggregationOperator.cs
- CqlQuery.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- ToolStripRenderer.cs
- EventSetter.cs
- AddIn.cs
- NameValueFileSectionHandler.cs
- bidPrivateBase.cs
- FormsAuthenticationConfiguration.cs
- RawKeyboardInputReport.cs
- ObjectConverter.cs
- RadioButtonBaseAdapter.cs
- FixedTextView.cs
- PrintPreviewControl.cs
- DocumentOrderQuery.cs
- ValidatingReaderNodeData.cs
- CreateUserErrorEventArgs.cs
- SectionUpdates.cs
- ValuePattern.cs
- FamilyCollection.cs
- DataGridTextBoxColumn.cs
- CompiledQueryCacheEntry.cs
- TextTreeExtractElementUndoUnit.cs
- SQLDouble.cs
- ListBase.cs
- Bitmap.cs
- PermissionRequestEvidence.cs
- DataGridViewCellParsingEventArgs.cs
- DataConnectionHelper.cs
- CombinedGeometry.cs
- printdlgexmarshaler.cs
- CompressStream.cs
- CommentEmitter.cs
- VirtualizingPanel.cs
- DataErrorValidationRule.cs