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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DSASignatureDeformatter.cs
- ModelPropertyCollectionImpl.cs
- ApplicationBuildProvider.cs
- IdnMapping.cs
- LinqDataView.cs
- InputProviderSite.cs
- DataMember.cs
- CodeMemberField.cs
- UiaCoreProviderApi.cs
- PageParserFilter.cs
- DeviceContext.cs
- StylusTouchDevice.cs
- PagerSettings.cs
- TogglePattern.cs
- COM2Enum.cs
- ExtensionElementCollection.cs
- PrintPreviewGraphics.cs
- StyleSelector.cs
- RegisteredArrayDeclaration.cs
- DoubleKeyFrameCollection.cs
- SystemTcpConnection.cs
- RouteParameter.cs
- ChannelEndpointElement.cs
- tooltip.cs
- LoginUtil.cs
- ResourceDisplayNameAttribute.cs
- SystemIPGlobalProperties.cs
- RotateTransform3D.cs
- XmlQualifiedName.cs
- GridSplitter.cs
- LeafCellTreeNode.cs
- InternalConfigRoot.cs
- HttpFileCollectionWrapper.cs
- BasePattern.cs
- PerfCounters.cs
- objectresult_tresulttype.cs
- NativeMethodsCLR.cs
- SerializationEventsCache.cs
- PropertyEmitter.cs
- MimeWriter.cs
- OutputCacheSection.cs
- AddInControllerImpl.cs
- ManagementPath.cs
- Compiler.cs
- srgsitem.cs
- XmlUrlEditor.cs
- ObjectStateManager.cs
- Memoizer.cs
- AdCreatedEventArgs.cs
- SqlCacheDependencyDatabaseCollection.cs
- TextMetrics.cs
- HostVisual.cs
- OperatingSystem.cs
- EntityDataSourceContextDisposingEventArgs.cs
- DoubleLinkListEnumerator.cs
- PathFigureCollection.cs
- WinInet.cs
- WhitespaceRuleReader.cs
- AnnotationResource.cs
- ResourceManager.cs
- ErrorFormatterPage.cs
- DbXmlEnabledProviderManifest.cs
- CqlQuery.cs
- DragAssistanceManager.cs
- UnsafeNativeMethods.cs
- UnsupportedPolicyOptionsException.cs
- Random.cs
- ThicknessConverter.cs
- RecognizerStateChangedEventArgs.cs
- ListViewEditEventArgs.cs
- ZipIOLocalFileBlock.cs
- TemplateComponentConnector.cs
- HttpProcessUtility.cs
- Propagator.Evaluator.cs
- HttpRequestBase.cs
- OpenFileDialog.cs
- NonSerializedAttribute.cs
- EndpointConfigContainer.cs
- CompensatableSequenceActivity.cs
- DbException.cs
- DtrList.cs
- UserUseLicenseDictionaryLoader.cs
- DocumentViewer.cs
- ExtenderProviderService.cs
- LinqDataSourceDeleteEventArgs.cs
- DesignerTransaction.cs
- ProxyBuilder.cs
- infer.cs
- InvokePatternIdentifiers.cs
- _HeaderInfoTable.cs
- KeyedQueue.cs
- DesignerActionUI.cs
- CellIdBoolean.cs
- UnhandledExceptionEventArgs.cs
- KerberosSecurityTokenProvider.cs
- JavaScriptString.cs
- AstTree.cs
- FontCacheUtil.cs
- WSHttpBindingBase.cs
- DataGridLinkButton.cs