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
- StaticExtension.cs
- EffectiveValueEntry.cs
- FontEditor.cs
- CqlLexerHelpers.cs
- Point3DCollectionValueSerializer.cs
- HuffmanTree.cs
- CommentEmitter.cs
- DrawingVisual.cs
- ContextInformation.cs
- KeySplineConverter.cs
- PageAsyncTaskManager.cs
- EventWaitHandleSecurity.cs
- XmlDocumentFragment.cs
- LinkUtilities.cs
- SpecialFolderEnumConverter.cs
- SafeLibraryHandle.cs
- ContentTextAutomationPeer.cs
- TransformGroup.cs
- RC2CryptoServiceProvider.cs
- Menu.cs
- CqlQuery.cs
- ContainerVisual.cs
- HttpHostedTransportConfiguration.cs
- PropertyCollection.cs
- DebugView.cs
- HttpFileCollection.cs
- CheckBoxBaseAdapter.cs
- PagesSection.cs
- StateManagedCollection.cs
- CodeGeneratorAttribute.cs
- HighlightVisual.cs
- ManualWorkflowSchedulerService.cs
- HttpRequestTraceRecord.cs
- PngBitmapDecoder.cs
- PerspectiveCamera.cs
- CharConverter.cs
- SerializationInfoEnumerator.cs
- TypeContext.cs
- TimelineClockCollection.cs
- InstalledVoice.cs
- ListViewItem.cs
- RelationshipManager.cs
- TileBrush.cs
- IndexObject.cs
- CompositeScriptReference.cs
- SynchronizingStream.cs
- SqlConnectionPoolProviderInfo.cs
- CompressEmulationStream.cs
- OciLobLocator.cs
- ImageCollectionCodeDomSerializer.cs
- MarkupCompiler.cs
- SoapAttributes.cs
- SystemNetHelpers.cs
- TextBoxAutoCompleteSourceConverter.cs
- XmlSchemaAnnotation.cs
- SessionStateSection.cs
- DataSetUtil.cs
- SafeCryptoHandles.cs
- Version.cs
- ResourceSet.cs
- ToolZone.cs
- ClientTargetSection.cs
- RowToFieldTransformer.cs
- FieldBuilder.cs
- EventsTab.cs
- Gdiplus.cs
- StdValidatorsAndConverters.cs
- ExtendedProperty.cs
- MimeFormatter.cs
- RegexCaptureCollection.cs
- ConnectionManagementSection.cs
- IteratorFilter.cs
- RoleService.cs
- LineServicesRun.cs
- AdornerLayer.cs
- TreeIterator.cs
- StorageEntityTypeMapping.cs
- UserCancellationException.cs
- ClientBuildManager.cs
- FileFormatException.cs
- IncrementalCompileAnalyzer.cs
- TreeView.cs
- DropDownButton.cs
- ServiceModelConfigurationSectionCollection.cs
- PageStatePersister.cs
- TypeLoadException.cs
- WindowsEditBoxRange.cs
- OracleDataReader.cs
- DataGridViewCellFormattingEventArgs.cs
- Span.cs
- LayoutInformation.cs
- EncoderParameters.cs
- StyleXamlTreeBuilder.cs
- SchemaConstraints.cs
- CqlParser.cs
- XmlCountingReader.cs
- TypedElement.cs
- AliasGenerator.cs
- CodeObjectCreateExpression.cs
- RecordConverter.cs