Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / WebControls / FontNamesConverter.cs / 1 / FontNamesConverter.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; ////// Converts a string with font names separated by commas to and from /// an array of strings containing individual names. /// [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] public class FontNamesConverter : TypeConverter { ////// Determines if the specified data type can be converted to an array of strings /// containing individual font names. /// public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string)) { return true; } return false; } ////// Parses a string that represents a list of font names separated by /// commas into an array of strings containing individual font names. /// public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { if (((string)value).Length == 0) { return new string[0]; } string[] names = ((string)value).Split(new char[] { culture.TextInfo.ListSeparator[0] }); for (int i = 0; i < names.Length; i++) { names[i] = names[i].Trim(); } return names; } throw GetConvertFromException(value); } ////// Creates a string that represents a list of font names separated /// by commas from an array of strings containing individual font names. /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string)) { if (value == null) { return String.Empty; } return string.Join(culture.TextInfo.ListSeparator, ((string[])value)); } throw GetConvertToException(value, destinationType); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ColorDialog.cs
- CollectionBuilder.cs
- Thread.cs
- DateTimePicker.cs
- PenThread.cs
- DiscoveryClientBindingElement.cs
- UnsafeNativeMethods.cs
- MemoryStream.cs
- ComponentDesigner.cs
- XmlNodeChangedEventManager.cs
- regiisutil.cs
- ServiceCredentials.cs
- TextRangeProviderWrapper.cs
- SmtpDateTime.cs
- TextTreeObjectNode.cs
- DialogWindow.cs
- XmlKeywords.cs
- ActivityExecutorDelegateInfo.cs
- DynamicDataRoute.cs
- HtmlInputButton.cs
- EditorPartCollection.cs
- SingleResultAttribute.cs
- TdsParserHelperClasses.cs
- RankException.cs
- DataContractAttribute.cs
- XmlTextEncoder.cs
- MatrixAnimationUsingKeyFrames.cs
- SiblingIterators.cs
- PropertyGridEditorPart.cs
- ControlIdConverter.cs
- EncodingTable.cs
- CornerRadius.cs
- SecureConversationServiceElement.cs
- UrlMapping.cs
- AnimatedTypeHelpers.cs
- ILGen.cs
- WebPartMenuStyle.cs
- ErrorFormatterPage.cs
- DetailsViewInsertEventArgs.cs
- WebBrowserContainer.cs
- DrawingGroup.cs
- TrimSurroundingWhitespaceAttribute.cs
- TrustManagerPromptUI.cs
- TypeUtil.cs
- TreePrinter.cs
- DNS.cs
- DayRenderEvent.cs
- Formatter.cs
- SoapFault.cs
- TabPage.cs
- IItemContainerGenerator.cs
- DescendentsWalkerBase.cs
- Base64Decoder.cs
- ObjectDataSourceFilteringEventArgs.cs
- SqlPersonalizationProvider.cs
- TypeReference.cs
- DrawingGroupDrawingContext.cs
- SafeJobHandle.cs
- ExchangeUtilities.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- FrugalMap.cs
- ColumnHeaderConverter.cs
- CustomErrorsSection.cs
- UriParserTemplates.cs
- UnsafeNativeMethods.cs
- SimpleModelProvider.cs
- WindowsClaimSet.cs
- ContainerVisual.cs
- TextWriterEngine.cs
- MatrixAnimationUsingPath.cs
- SuppressIldasmAttribute.cs
- HttpAsyncResult.cs
- StateMachineWorkflowDesigner.cs
- DependencyPropertyChangedEventArgs.cs
- Variable.cs
- TypeHelpers.cs
- Misc.cs
- RequestContext.cs
- NavigationWindowAutomationPeer.cs
- OutputCacheSettingsSection.cs
- ReferencedAssembly.cs
- ClickablePoint.cs
- FrameworkReadOnlyPropertyMetadata.cs
- ThreadAttributes.cs
- CryptographicAttribute.cs
- TransactionFlowProperty.cs
- Package.cs
- PrimitiveOperationFormatter.cs
- Win32.cs
- PropertyEntry.cs
- ImportContext.cs
- HtmlSelect.cs
- Application.cs
- ConfigsHelper.cs
- SystemTcpStatistics.cs
- TextTreeFixupNode.cs
- Camera.cs
- XmlSchemaExternal.cs
- AssemblyBuilder.cs
- XmlSchemaDatatype.cs