Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CompMod / System / ComponentModel / StringConverter.cs / 1 / StringConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.ComponentModel { using System.Diagnostics; using System.Globalization; using System.Runtime.InteropServices; using System.Runtime.Remoting; using System.Runtime.Serialization.Formatters; using System.Security.Permissions; ////// [HostProtection(SharedState = true)] public class StringConverter : TypeConverter { ///Provides a type converter to convert string objects to and from various other /// representations. ////// public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string)) { return true; } return base.CanConvertFrom(context, sourceType); } ///Gets a value indicating whether this converter can convert an object in the /// given source type to a string using the specified context. ////// public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { return (string)value; } if (value == null) { return ""; } return base.ConvertFrom(context, culture, value); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //Converts the specified value object to a string object. ///// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.ComponentModel { using System.Diagnostics; using System.Globalization; using System.Runtime.InteropServices; using System.Runtime.Remoting; using System.Runtime.Serialization.Formatters; using System.Security.Permissions; ////// [HostProtection(SharedState = true)] public class StringConverter : TypeConverter { ///Provides a type converter to convert string objects to and from various other /// representations. ////// public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string)) { return true; } return base.CanConvertFrom(context, sourceType); } ///Gets a value indicating whether this converter can convert an object in the /// given source type to a string using the specified context. ////// public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { return (string)value; } if (value == null) { return ""; } return base.ConvertFrom(context, culture, value); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.Converts the specified value object to a string object. ///
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HostingEnvironmentException.cs
- _NegoState.cs
- Literal.cs
- GeneralTransform3DCollection.cs
- GAC.cs
- securestring.cs
- CreateUserErrorEventArgs.cs
- GenericPrincipal.cs
- Parser.cs
- HierarchicalDataTemplate.cs
- ParseNumbers.cs
- ResourceExpression.cs
- nulltextcontainer.cs
- SystemIPGlobalProperties.cs
- SiteOfOriginContainer.cs
- DataRelationPropertyDescriptor.cs
- PartitionedStream.cs
- XmlNodeReader.cs
- EventMappingSettings.cs
- MasterPageBuildProvider.cs
- CommandLineParser.cs
- ProbeMatchesMessage11.cs
- FileDataSourceCache.cs
- MultipleViewProviderWrapper.cs
- HelpEvent.cs
- ValidationHelpers.cs
- XPathNavigatorKeyComparer.cs
- FormClosingEvent.cs
- SafeHandles.cs
- TransactionBehavior.cs
- EventLog.cs
- _ListenerRequestStream.cs
- CheckoutException.cs
- TextContainerChangedEventArgs.cs
- XPathSingletonIterator.cs
- DataPager.cs
- ExpressionBuilder.cs
- DeclaredTypeValidatorAttribute.cs
- ScrollItemPattern.cs
- Assembly.cs
- ReadOnlyCollectionBase.cs
- EntityDataSourceDataSelectionPanel.cs
- SqlGenerator.cs
- BackgroundWorker.cs
- XmlDictionary.cs
- ImageFormatConverter.cs
- Dispatcher.cs
- PageCanvasSize.cs
- NativeWindow.cs
- DataGridTablesFactory.cs
- DataGridCellsPanel.cs
- PointAnimationUsingPath.cs
- SelectionChangedEventArgs.cs
- ReadOnlyAttribute.cs
- MasterPageParser.cs
- ISessionStateStore.cs
- _ProxyChain.cs
- SqlIdentifier.cs
- Attribute.cs
- WasHostedComPlusFactory.cs
- DetailsViewInsertEventArgs.cs
- HyperLinkField.cs
- PeerOutputChannel.cs
- httpstaticobjectscollection.cs
- ApplicationGesture.cs
- _SpnDictionary.cs
- IntPtr.cs
- PeerName.cs
- ScopelessEnumAttribute.cs
- ActionMessageFilterTable.cs
- GetWinFXPath.cs
- DiagnosticTrace.cs
- DateTimeConverter.cs
- HttpVersion.cs
- PersonalizationStateInfoCollection.cs
- IdentityNotMappedException.cs
- RequestContext.cs
- XmlName.cs
- EntityDataSource.cs
- HtmlInputPassword.cs
- CodeTypeParameter.cs
- DataList.cs
- Itemizer.cs
- OdbcConnectionHandle.cs
- RawTextInputReport.cs
- Int64.cs
- DbTransaction.cs
- SymmetricAlgorithm.cs
- WindowsMenu.cs
- SoapExtensionImporter.cs
- XmlSerializationReader.cs
- DBSchemaTable.cs
- ApplicationGesture.cs
- SelectionEditor.cs
- SessionStateUtil.cs
- HttpCookie.cs
- ExpressionCopier.cs
- WorkflowTimerService.cs
- ListBox.cs
- AttributeTableBuilder.cs