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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FixedTextSelectionProcessor.cs
- OdbcConnectionOpen.cs
- TableItemPattern.cs
- ComponentEvent.cs
- DtrList.cs
- JpegBitmapDecoder.cs
- CustomCategoryAttribute.cs
- MULTI_QI.cs
- CodeCommentStatement.cs
- WebPartManager.cs
- pingexception.cs
- PropertyChangeTracker.cs
- DivideByZeroException.cs
- PointLight.cs
- X509Chain.cs
- QueryInterceptorAttribute.cs
- OperationResponse.cs
- JsonFormatWriterGenerator.cs
- SystemEvents.cs
- DataGridCommandEventArgs.cs
- _Semaphore.cs
- EncryptedXml.cs
- RectangleHotSpot.cs
- WeakReferenceKey.cs
- DecoderExceptionFallback.cs
- SearchForVirtualItemEventArgs.cs
- MutexSecurity.cs
- SystemResources.cs
- ConfigurationValidatorAttribute.cs
- AutomationPropertyInfo.cs
- EpmContentDeSerializerBase.cs
- ApplyHostConfigurationBehavior.cs
- WindowsBrush.cs
- ValidationResult.cs
- DiffuseMaterial.cs
- MemberDescriptor.cs
- SynchronizedPool.cs
- MultiTargetingUtil.cs
- HMACSHA256.cs
- NameValueCollection.cs
- XmlSigningNodeWriter.cs
- ToolStrip.cs
- TranslateTransform3D.cs
- GPPOINTF.cs
- Monitor.cs
- ProtocolsSection.cs
- Repeater.cs
- InvokeGenerator.cs
- ItemCollection.cs
- sqlnorm.cs
- ApplyImportsAction.cs
- DbProviderFactoriesConfigurationHandler.cs
- CodeExporter.cs
- CompilationRelaxations.cs
- ColumnMapCopier.cs
- OpenFileDialog.cs
- OracleRowUpdatedEventArgs.cs
- LinkClickEvent.cs
- TableCell.cs
- ListViewGroupCollectionEditor.cs
- UrlPath.cs
- ToolStripSeparatorRenderEventArgs.cs
- CodeObjectCreateExpression.cs
- Hyperlink.cs
- PaginationProgressEventArgs.cs
- SortFieldComparer.cs
- WebPartMenuStyle.cs
- ListViewCommandEventArgs.cs
- TreeNodeBindingCollection.cs
- UpdatePanel.cs
- CodeGen.cs
- DataViewManagerListItemTypeDescriptor.cs
- SessionStateUtil.cs
- FieldTemplateFactory.cs
- XsltCompileContext.cs
- BrowserTree.cs
- OrderedDictionary.cs
- XamlInterfaces.cs
- ReflectPropertyDescriptor.cs
- HelpEvent.cs
- FormClosingEvent.cs
- TraceContextRecord.cs
- SafeNativeMethodsCLR.cs
- ResourcePart.cs
- EdmRelationshipRoleAttribute.cs
- AddingNewEventArgs.cs
- ImageButton.cs
- GeneralTransform2DTo3DTo2D.cs
- ValidatingCollection.cs
- URLAttribute.cs
- _FtpControlStream.cs
- AnnotationResourceCollection.cs
- InputDevice.cs
- RegistrySecurity.cs
- SiteMapDataSource.cs
- VsPropertyGrid.cs
- DocumentPageHost.cs
- HttpCachePolicyElement.cs
- InplaceBitmapMetadataWriter.cs
- ConnectionStringSettingsCollection.cs