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
- Compiler.cs
- TemplateColumn.cs
- TimelineCollection.cs
- ErrorHandler.cs
- CommandHelpers.cs
- DPTypeDescriptorContext.cs
- WebHttpBindingCollectionElement.cs
- MaskedTextBoxTextEditor.cs
- Unit.cs
- DataServiceEntityAttribute.cs
- CompressionTransform.cs
- ResourceProviderFactory.cs
- ComNativeDescriptor.cs
- DbConnectionClosed.cs
- ZoomPercentageConverter.cs
- InputLangChangeEvent.cs
- InstallerTypeAttribute.cs
- IntSecurity.cs
- Frame.cs
- FrameworkContentElement.cs
- SafeThreadHandle.cs
- EDesignUtil.cs
- StrokeNodeEnumerator.cs
- FaultCode.cs
- BaseProcessor.cs
- Hashtable.cs
- AliasGenerator.cs
- ModuleElement.cs
- CustomErrorsSection.cs
- FileUtil.cs
- XmlAttributeOverrides.cs
- SecurityTokenInclusionMode.cs
- TcpChannelHelper.cs
- PasswordTextContainer.cs
- DefaultHttpHandler.cs
- DecoderReplacementFallback.cs
- RoutedEventHandlerInfo.cs
- PlatformCulture.cs
- DataPagerField.cs
- HashAlgorithm.cs
- DisplayMemberTemplateSelector.cs
- DbConnectionPoolOptions.cs
- CalendarAutoFormatDialog.cs
- DataMemberListEditor.cs
- PersonalizablePropertyEntry.cs
- VectorAnimation.cs
- VariableReference.cs
- ListViewItemEventArgs.cs
- QilPatternFactory.cs
- QuaternionConverter.cs
- TreeViewBindingsEditor.cs
- SamlDoNotCacheCondition.cs
- ContentTextAutomationPeer.cs
- Restrictions.cs
- WebEventCodes.cs
- ViewStateChangedEventArgs.cs
- ObjectTypeMapping.cs
- KeyConstraint.cs
- SqlTriggerContext.cs
- ObjectDataSourceEventArgs.cs
- IntranetCredentialPolicy.cs
- ScrollBar.cs
- MemberDomainMap.cs
- RoleManagerModule.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- validationstate.cs
- ButtonAutomationPeer.cs
- ProviderUtil.cs
- ButtonChrome.cs
- ColorTransformHelper.cs
- ICspAsymmetricAlgorithm.cs
- BuildManagerHost.cs
- DependencyObject.cs
- PartManifestEntry.cs
- FormsAuthenticationEventArgs.cs
- HttpCacheVary.cs
- XmlIlTypeHelper.cs
- ArgumentOutOfRangeException.cs
- ExpandCollapsePattern.cs
- FormParameter.cs
- Point3DAnimation.cs
- ModuleElement.cs
- EncoderBestFitFallback.cs
- MaskDescriptors.cs
- GenericEnumerator.cs
- __ComObject.cs
- Comparer.cs
- UInt64Converter.cs
- ExternalCalls.cs
- HttpListenerResponse.cs
- UnsafeNativeMethods.cs
- DataColumnMapping.cs
- InfoCardRSACryptoProvider.cs
- TypefaceCollection.cs
- AutomationElementCollection.cs
- Evidence.cs
- HtmlEmptyTagControlBuilder.cs
- SemaphoreSecurity.cs
- AttachedAnnotationChangedEventArgs.cs
- IChannel.cs