Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XslNumber.cs
- FontResourceCache.cs
- EventHandlerList.cs
- TemplatePropertyEntry.cs
- QuaternionAnimation.cs
- ClonableStack.cs
- ExplicitDiscriminatorMap.cs
- PerformanceCounterCategory.cs
- TemplatePropertyEntry.cs
- TemplatedMailWebEventProvider.cs
- ListChangedEventArgs.cs
- XamlTreeBuilderBamlRecordWriter.cs
- SqlConnectionHelper.cs
- GlobalItem.cs
- HttpVersion.cs
- ItemTypeToolStripMenuItem.cs
- Binding.cs
- UserPreferenceChangedEventArgs.cs
- CustomLineCap.cs
- Point4DValueSerializer.cs
- JoinSymbol.cs
- TextRange.cs
- XmlSerializationWriter.cs
- Stack.cs
- DataGridViewCellPaintingEventArgs.cs
- EndpointIdentityExtension.cs
- fixedPageContentExtractor.cs
- Timeline.cs
- Decoder.cs
- RepeaterItemEventArgs.cs
- GetLedgerRequest.cs
- SecurityManager.cs
- SplayTreeNode.cs
- ContainerVisual.cs
- assertwrapper.cs
- AesManaged.cs
- AnimatedTypeHelpers.cs
- figurelengthconverter.cs
- SymbolType.cs
- TableLayout.cs
- userdatakeys.cs
- ColorConvertedBitmapExtension.cs
- Exceptions.cs
- ScriptingRoleServiceSection.cs
- XmlSerializationWriter.cs
- SHA256.cs
- KeyedQueue.cs
- FaultImportOptions.cs
- TdsParserSessionPool.cs
- BamlLocalizableResource.cs
- SoapObjectInfo.cs
- SqlRewriteScalarSubqueries.cs
- ButtonColumn.cs
- InfiniteIntConverter.cs
- HttpPostProtocolReflector.cs
- RankException.cs
- WorkflowApplicationEventArgs.cs
- GACMembershipCondition.cs
- ErrorHandlerFaultInfo.cs
- TemplateManager.cs
- ITextView.cs
- XmlRootAttribute.cs
- HttpCachePolicy.cs
- PenContexts.cs
- HttpPostedFileBase.cs
- UIElementPropertyUndoUnit.cs
- ToolStripMenuItem.cs
- Message.cs
- Task.cs
- FunctionNode.cs
- EntitySetBaseCollection.cs
- NavigationWindow.cs
- BooleanStorage.cs
- NativeWindow.cs
- TreeView.cs
- Serializer.cs
- Events.cs
- SoapReflector.cs
- XslUrlEditor.cs
- DetailsView.cs
- ConfigXmlAttribute.cs
- DockPatternIdentifiers.cs
- EntitySqlQueryBuilder.cs
- SeekStoryboard.cs
- GPRECT.cs
- WebReference.cs
- SecurityDescriptor.cs
- FlowLayoutSettings.cs
- GeometryConverter.cs
- GetPageNumberCompletedEventArgs.cs
- ProxyWebPartManager.cs
- CustomAttribute.cs
- Int16KeyFrameCollection.cs
- OpenTypeLayoutCache.cs
- CommonProperties.cs
- Parameter.cs
- srgsitem.cs
- LinearKeyFrames.cs
- BackStopAuthenticationModule.cs
- DynamicMethod.cs