Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- InvalidDataException.cs
- ValueUnavailableException.cs
- WebPartExportVerb.cs
- IInstanceContextProvider.cs
- MessageHeader.cs
- SettingsSection.cs
- sapiproxy.cs
- RtType.cs
- XmlObjectSerializerWriteContextComplex.cs
- Base64Encoder.cs
- MsmqActivation.cs
- XmlSchemaCollection.cs
- SQLBytes.cs
- ObjectStateManagerMetadata.cs
- DependencySource.cs
- ObjectSecurity.cs
- DateTimeHelper.cs
- VisemeEventArgs.cs
- DashStyle.cs
- Empty.cs
- BaseDataListPage.cs
- PixelFormatConverter.cs
- WebPartVerbsEventArgs.cs
- DesignerAttribute.cs
- MetadataUtil.cs
- BitmapCacheBrush.cs
- ClientProxyGenerator.cs
- ValueTypeFixupInfo.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- ZeroOpNode.cs
- MulticastDelegate.cs
- XmlArrayItemAttributes.cs
- MsmqQueue.cs
- OdbcParameter.cs
- AssociationProvider.cs
- MgmtResManager.cs
- BeginStoryboard.cs
- DesignerTextBoxAdapter.cs
- GlyphElement.cs
- AnimatedTypeHelpers.cs
- BinaryWriter.cs
- AssemblyInfo.cs
- SimpleExpression.cs
- CryptoKeySecurity.cs
- Int64Animation.cs
- ConnectionStringsExpressionBuilder.cs
- TransportSecurityProtocolFactory.cs
- SmtpFailedRecipientException.cs
- StreamSecurityUpgradeAcceptor.cs
- WSSecurityTokenSerializer.cs
- Ref.cs
- DependencyObjectPropertyDescriptor.cs
- brushes.cs
- X509Chain.cs
- CompositeTypefaceMetrics.cs
- SecurityState.cs
- SoapIgnoreAttribute.cs
- Decimal.cs
- NamespaceEmitter.cs
- BevelBitmapEffect.cs
- CompilerErrorCollection.cs
- XmlSchemaDatatype.cs
- ActiveDesignSurfaceEvent.cs
- HandlerBase.cs
- EventHandlerList.cs
- HttpPostServerProtocol.cs
- WebPermission.cs
- DocumentViewerHelper.cs
- OleDbParameterCollection.cs
- ScriptServiceAttribute.cs
- MultiView.cs
- FontStretch.cs
- XmlCharacterData.cs
- ExtensionDataObject.cs
- GrammarBuilderRuleRef.cs
- ThousandthOfEmRealPoints.cs
- ResolveNameEventArgs.cs
- jithelpers.cs
- adornercollection.cs
- UxThemeWrapper.cs
- DelayLoadType.cs
- DrawToolTipEventArgs.cs
- SafeCertificateStore.cs
- MiniParameterInfo.cs
- XmlAnyElementAttribute.cs
- AutomationPatternInfo.cs
- UrlPath.cs
- StateMachineSubscriptionManager.cs
- TableLayoutSettings.cs
- RequestBringIntoViewEventArgs.cs
- SatelliteContractVersionAttribute.cs
- XhtmlBasicCommandAdapter.cs
- DbConnectionFactory.cs
- InternalControlCollection.cs
- LeftCellWrapper.cs
- WindowsFormsHostPropertyMap.cs
- HtmlTextBoxAdapter.cs
- ToolStripManager.cs
- basecomparevalidator.cs
- Char.cs