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
- InputQueue.cs
- DataPagerFieldCollection.cs
- MsmqInputMessage.cs
- DirectoryObjectSecurity.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- ActivationWorker.cs
- AspNetSynchronizationContext.cs
- FreezableDefaultValueFactory.cs
- DoubleAnimationUsingPath.cs
- ComplexLine.cs
- SurrogateChar.cs
- PenThreadWorker.cs
- CapabilitiesAssignment.cs
- Int32Storage.cs
- WebContentFormatHelper.cs
- SafeIUnknown.cs
- AssemblyHash.cs
- AnnotationResource.cs
- InstanceDescriptor.cs
- UnknownBitmapDecoder.cs
- SemanticTag.cs
- StyleHelper.cs
- MenuItemBindingCollection.cs
- SortedSet.cs
- embossbitmapeffect.cs
- MessageRpc.cs
- ListControlConvertEventArgs.cs
- ExportOptions.cs
- MessagePartSpecification.cs
- SslStreamSecurityUpgradeProvider.cs
- DataTableMapping.cs
- Vector3DKeyFrameCollection.cs
- ObjectHandle.cs
- WSDualHttpBindingElement.cs
- Visual3D.cs
- DataServiceHostFactory.cs
- EmbossBitmapEffect.cs
- IBuiltInEvidence.cs
- LocalizedNameDescriptionPair.cs
- XamlReader.cs
- COM2EnumConverter.cs
- ProcessInfo.cs
- SqlUnionizer.cs
- DataViewSettingCollection.cs
- XmlResolver.cs
- InstanceCreationEditor.cs
- CustomBindingElement.cs
- DocumentViewerBase.cs
- AttributeCollection.cs
- SoapEnumAttribute.cs
- HttpListenerPrefixCollection.cs
- QualifierSet.cs
- DesignerLinkAdapter.cs
- StyleConverter.cs
- HtmlInputImage.cs
- ImagingCache.cs
- IdentityReference.cs
- TCEAdapterGenerator.cs
- EntityDataSourceWizardForm.cs
- DeviceContext2.cs
- RuntimeWrappedException.cs
- TypeHelpers.cs
- XmlAttributeAttribute.cs
- SqlNodeAnnotation.cs
- ColorAnimationBase.cs
- BackEase.cs
- NativeMethods.cs
- XmlSchemaFacet.cs
- PerformanceCounter.cs
- SimpleTextLine.cs
- SymmetricAlgorithm.cs
- CharacterMetricsDictionary.cs
- ProfileBuildProvider.cs
- CodeTypeReference.cs
- VisualStateManager.cs
- PerformanceCounterPermission.cs
- StringCollection.cs
- SynchronousSendBindingElement.cs
- Compiler.cs
- SQLInt16.cs
- ThicknessAnimationBase.cs
- DiscoveryDocumentSearchPattern.cs
- DoWorkEventArgs.cs
- _StreamFramer.cs
- ComponentEditorPage.cs
- MetadataFile.cs
- PageContent.cs
- DPAPIProtectedConfigurationProvider.cs
- PopupRootAutomationPeer.cs
- ReturnEventArgs.cs
- ObjectDataSource.cs
- latinshape.cs
- X509CertificateCollection.cs
- Polygon.cs
- UserControl.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- SqlTypeSystemProvider.cs
- ToolboxItemWrapper.cs
- EntityKey.cs
- BaseTreeIterator.cs