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
- DropShadowEffect.cs
- VectorConverter.cs
- DictionaryEntry.cs
- ReadWriteSpinLock.cs
- EmptyStringExpandableObjectConverter.cs
- GACIdentityPermission.cs
- CalendarTable.cs
- safePerfProviderHandle.cs
- coordinatorfactory.cs
- NodeInfo.cs
- SystemInformation.cs
- CodeExporter.cs
- InProcStateClientManager.cs
- ActivityWithResultValueSerializer.cs
- DataServiceQueryProvider.cs
- QueryReaderSettings.cs
- WhitespaceRule.cs
- SeekableReadStream.cs
- RequestSecurityToken.cs
- ImmutableAssemblyCacheEntry.cs
- EdmProperty.cs
- Certificate.cs
- DateTimePickerDesigner.cs
- PathGradientBrush.cs
- HttpConfigurationContext.cs
- ScrollItemPattern.cs
- Atom10FormatterFactory.cs
- PinnedBufferMemoryStream.cs
- DataBindingCollectionEditor.cs
- AsyncResult.cs
- ParserHooks.cs
- DbgUtil.cs
- CollectionChangeEventArgs.cs
- DataTrigger.cs
- InstalledVoice.cs
- DataGridViewRowsRemovedEventArgs.cs
- XmlILModule.cs
- FontSizeConverter.cs
- PolicyException.cs
- ChannelManager.cs
- HttpServerVarsCollection.cs
- TrustSection.cs
- _NetRes.cs
- BuildProvider.cs
- RequestNavigateEventArgs.cs
- TransformedBitmap.cs
- InlineObject.cs
- ObjectListCommandCollection.cs
- WindowsRegion.cs
- TagMapCollection.cs
- XamlToRtfParser.cs
- cache.cs
- XmlRawWriterWrapper.cs
- FunctionParameter.cs
- Formatter.cs
- DynamicControlParameter.cs
- ElementMarkupObject.cs
- HtmlLink.cs
- SimpleColumnProvider.cs
- CodeParameterDeclarationExpression.cs
- PointLightBase.cs
- WebPartTransformerAttribute.cs
- MessagingDescriptionAttribute.cs
- SQLDouble.cs
- SqlDataSourceParameterParser.cs
- TextSimpleMarkerProperties.cs
- ApplicationException.cs
- FormattedTextSymbols.cs
- SQLByteStorage.cs
- System.Data.OracleClient_BID.cs
- QuaternionAnimationBase.cs
- EntityDataSourceWrapperCollection.cs
- ExpressionNode.cs
- DataGrid.cs
- WmlValidatorAdapter.cs
- TransactionFlowElement.cs
- StatusBarPanelClickEvent.cs
- XmlReflectionMember.cs
- RegisteredHiddenField.cs
- UInt64Converter.cs
- FieldTemplateFactory.cs
- FontFamilyValueSerializer.cs
- MarkupExtensionReturnTypeAttribute.cs
- MenuItemBinding.cs
- FederatedMessageSecurityOverHttp.cs
- ValueChangedEventManager.cs
- EntityDataSourceSelectingEventArgs.cs
- dtdvalidator.cs
- XmlQueryContext.cs
- VirtualizingPanel.cs
- Profiler.cs
- RegisteredDisposeScript.cs
- GeometryModel3D.cs
- Set.cs
- TextTrailingCharacterEllipsis.cs
- Roles.cs
- ReversePositionQuery.cs
- ApplicationServicesHostFactory.cs
- CodePageUtils.cs
- PopOutPanel.cs