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
- StandardCommandToolStripMenuItem.cs
- SmiMetaData.cs
- VariableDesigner.xaml.cs
- GraphicsContainer.cs
- TreeNodeConverter.cs
- Vector3DValueSerializer.cs
- ComponentCodeDomSerializer.cs
- regiisutil.cs
- Decimal.cs
- ParserContext.cs
- TextElementCollectionHelper.cs
- CngProperty.cs
- StringFormat.cs
- NameHandler.cs
- DocumentXPathNavigator.cs
- CodeCompiler.cs
- SoapFault.cs
- VisualTransition.cs
- HttpCacheParams.cs
- DocumentAutomationPeer.cs
- SQLMoneyStorage.cs
- SharedConnectionInfo.cs
- DropDownList.cs
- TableAdapterManagerMethodGenerator.cs
- Wrapper.cs
- DataStreams.cs
- BindingContext.cs
- PropertyDescriptor.cs
- DurableInstanceProvider.cs
- FilteredDataSetHelper.cs
- ToolStripContentPanel.cs
- ResolveNameEventArgs.cs
- ControlCachePolicy.cs
- SynchronousChannel.cs
- HttpPostProtocolReflector.cs
- CapabilitiesSection.cs
- SqlBuilder.cs
- HttpContextServiceHost.cs
- GenericUriParser.cs
- AttributeCallbackBuilder.cs
- Nullable.cs
- UmAlQuraCalendar.cs
- RegisteredHiddenField.cs
- CodeMemberProperty.cs
- MenuCommands.cs
- ListViewDeleteEventArgs.cs
- EnumConverter.cs
- GridViewColumnCollection.cs
- UIElementCollection.cs
- HttpCapabilitiesBase.cs
- EntityStoreSchemaGenerator.cs
- StringUtil.cs
- DockAndAnchorLayout.cs
- CommandID.cs
- ResourceCategoryAttribute.cs
- HashHelper.cs
- XmlToDatasetMap.cs
- WinCategoryAttribute.cs
- RichTextBox.cs
- EncoderFallback.cs
- SmiConnection.cs
- KeyValueConfigurationCollection.cs
- VisualBrush.cs
- SoapFault.cs
- SafeLibraryHandle.cs
- TableLayoutPanelCellPosition.cs
- ReferentialConstraintRoleElement.cs
- XmlBinaryReader.cs
- Rect3DConverter.cs
- CodeNamespaceImportCollection.cs
- WriterOutput.cs
- ValueCollectionParameterReader.cs
- TextDecorationCollection.cs
- ExceptionCollection.cs
- AxHost.cs
- OutputCacheModule.cs
- RealProxy.cs
- TextEditorLists.cs
- ConnectionPointCookie.cs
- BinaryObjectWriter.cs
- IERequestCache.cs
- Floater.cs
- CodeCatchClause.cs
- ExpandCollapseProviderWrapper.cs
- BufferedReadStream.cs
- ShutDownListener.cs
- PersonalizableTypeEntry.cs
- InfoCardTrace.cs
- AsyncResult.cs
- Calendar.cs
- PeerHopCountAttribute.cs
- SqlClientWrapperSmiStreamChars.cs
- OperationInfoBase.cs
- CompModSwitches.cs
- AppSettingsSection.cs
- StylusDevice.cs
- ThreadInterruptedException.cs
- PersonalizationProvider.cs
- NGCPageContentCollectionSerializerAsync.cs
- ConfigXmlReader.cs