Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / StringConverter.cs / 1305376 / 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
- SystemResources.cs
- ReferenceEqualityComparer.cs
- InputLanguageSource.cs
- UnauthorizedWebPart.cs
- MethodBody.cs
- XmlFormatExtensionAttribute.cs
- EFAssociationProvider.cs
- RemotingServices.cs
- RangeValueProviderWrapper.cs
- NativeMethods.cs
- ChannelPoolSettings.cs
- DataGridRowHeader.cs
- TraceInternal.cs
- AxisAngleRotation3D.cs
- OLEDB_Enum.cs
- brushes.cs
- ToolStripSplitStackLayout.cs
- TextAutomationPeer.cs
- XPathAxisIterator.cs
- SynchronizationLockException.cs
- DecoderNLS.cs
- BasicHttpSecurityMode.cs
- DataGridViewCellStyleEditor.cs
- Stopwatch.cs
- CalendarDay.cs
- ConvertersCollection.cs
- RequestDescription.cs
- HtmlPageAdapter.cs
- ColumnMapVisitor.cs
- FormatException.cs
- BaseCodeDomTreeGenerator.cs
- NodeInfo.cs
- IPEndPoint.cs
- StackOverflowException.cs
- PngBitmapDecoder.cs
- GridProviderWrapper.cs
- IisTraceListener.cs
- CollectionView.cs
- SecurityPolicySection.cs
- TimeSpanConverter.cs
- Sql8ExpressionRewriter.cs
- RandomNumberGenerator.cs
- DesignerView.xaml.cs
- IdnMapping.cs
- _SSPIWrapper.cs
- SiteMapNodeCollection.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- GenericAuthenticationEventArgs.cs
- ServiceModelConfigurationSection.cs
- BeginEvent.cs
- DllNotFoundException.cs
- SponsorHelper.cs
- SemanticResolver.cs
- HelpProvider.cs
- TableColumn.cs
- FloaterParagraph.cs
- TimeEnumHelper.cs
- IndexedString.cs
- IisTraceListener.cs
- ObjectManager.cs
- ActivityBindForm.Designer.cs
- Exceptions.cs
- UdpMessageProperty.cs
- ProviderSettings.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- ColumnResult.cs
- AssemblyGen.cs
- ChildrenQuery.cs
- DataRecordInfo.cs
- LayoutInformation.cs
- FormCollection.cs
- PathStreamGeometryContext.cs
- CommonRemoteMemoryBlock.cs
- MutexSecurity.cs
- HandleCollector.cs
- PrimitiveType.cs
- ToolStripPanelRenderEventArgs.cs
- WSFederationHttpSecurity.cs
- NetworkInformationPermission.cs
- JpegBitmapDecoder.cs
- XsdDateTime.cs
- DispatcherHookEventArgs.cs
- ConfigurationPropertyAttribute.cs
- TextDecoration.cs
- SiteMapDataSource.cs
- Input.cs
- DeflateStream.cs
- TrustManagerPromptUI.cs
- HierarchicalDataTemplate.cs
- SessionPageStatePersister.cs
- SmtpNegotiateAuthenticationModule.cs
- SmtpSection.cs
- Camera.cs
- HideDisabledControlAdapter.cs
- LogSwitch.cs
- Ref.cs
- PageContentCollection.cs
- DataPointer.cs
- _NegoState.cs
- unsafenativemethodsother.cs