Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- HttpListenerTimeoutManager.cs
- StateDesigner.LayoutSelectionGlyph.cs
- PLINQETWProvider.cs
- FileLogRecordHeader.cs
- CodeTryCatchFinallyStatement.cs
- ImageSourceConverter.cs
- ListBindingConverter.cs
- HttpConfigurationContext.cs
- VirtualPath.cs
- UdpDiscoveryEndpointProvider.cs
- DynamicControl.cs
- PnrpPermission.cs
- SessionViewState.cs
- ToolStripItemClickedEventArgs.cs
- DataMember.cs
- FontStyle.cs
- AuthorizationRuleCollection.cs
- ProjectionCamera.cs
- TcpProcessProtocolHandler.cs
- KnownBoxes.cs
- EllipseGeometry.cs
- HttpAsyncResult.cs
- DatePickerDateValidationErrorEventArgs.cs
- DocumentGridPage.cs
- UInt32Converter.cs
- MimeTypeMapper.cs
- NonPrimarySelectionGlyph.cs
- MaskInputRejectedEventArgs.cs
- HashAlgorithm.cs
- XmlNodeReader.cs
- ClientSettingsSection.cs
- BrushValueSerializer.cs
- WpfKnownTypeInvoker.cs
- ProviderMetadataCachedInformation.cs
- DesignerTransaction.cs
- PenThreadPool.cs
- CookieParameter.cs
- FreeFormPanel.cs
- GeometryModel3D.cs
- embossbitmapeffect.cs
- ImageMap.cs
- DirtyTextRange.cs
- X509CertificateValidator.cs
- EventsTab.cs
- HMACSHA256.cs
- EdmComplexTypeAttribute.cs
- Utils.cs
- SystemBrushes.cs
- InternalCache.cs
- SpecialNameAttribute.cs
- CodeDelegateCreateExpression.cs
- ImageField.cs
- PageTheme.cs
- _NegoState.cs
- Condition.cs
- DynamicILGenerator.cs
- NumberFunctions.cs
- _TLSstream.cs
- SerialErrors.cs
- HandleRef.cs
- NavigateEvent.cs
- ListViewAutomationPeer.cs
- GridViewColumnHeader.cs
- CodeGenerator.cs
- AssociationSet.cs
- FilterQuery.cs
- InputBinder.cs
- BinaryConverter.cs
- CodeDesigner.cs
- VectorAnimationUsingKeyFrames.cs
- FixedTextView.cs
- WindowVisualStateTracker.cs
- HScrollBar.cs
- SecurityPermission.cs
- NavigationCommands.cs
- SiteMap.cs
- PrefixHandle.cs
- DesignerWithHeader.cs
- BindingMemberInfo.cs
- hresults.cs
- ContentPropertyAttribute.cs
- EntityDataSourceState.cs
- EventSetter.cs
- RelatedEnd.cs
- GeometryConverter.cs
- TextChangedEventArgs.cs
- SweepDirectionValidation.cs
- OleDbException.cs
- metadatamappinghashervisitor.cs
- XmlSchemaCollection.cs
- AxHost.cs
- TrustManagerPromptUI.cs
- Pkcs7Recipient.cs
- SqlMetaData.cs
- ConstraintConverter.cs
- MouseActionConverter.cs
- Style.cs
- GradientSpreadMethodValidation.cs
- EntityAdapter.cs
- WindowsGraphicsCacheManager.cs