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
- XmlExceptionHelper.cs
- ScrollChrome.cs
- ExtendedProperty.cs
- NetworkInformationPermission.cs
- _TimerThread.cs
- ResourceDisplayNameAttribute.cs
- DataObject.cs
- XsdBuildProvider.cs
- UIElement3D.cs
- DataSourceControlBuilder.cs
- HttpHandlerActionCollection.cs
- X509PeerCertificateElement.cs
- AsymmetricAlgorithm.cs
- WebBrowsableAttribute.cs
- ColumnResizeAdorner.cs
- PerformanceCountersElement.cs
- DataObject.cs
- XmlNamedNodeMap.cs
- InProcStateClientManager.cs
- FrameworkElementAutomationPeer.cs
- Emitter.cs
- ILGenerator.cs
- IPeerNeighbor.cs
- UserValidatedEventArgs.cs
- WebServiceResponse.cs
- FixedTextSelectionProcessor.cs
- AccessViolationException.cs
- BitmapImage.cs
- ConfigurationValue.cs
- GroupItemAutomationPeer.cs
- RowCache.cs
- SizeFConverter.cs
- loginstatus.cs
- FileCodeGroup.cs
- UpdateProgress.cs
- PkcsMisc.cs
- DocumentEventArgs.cs
- StoreItemCollection.Loader.cs
- CompositeCollection.cs
- OdbcConnectionOpen.cs
- ContentDesigner.cs
- ThemeInfoAttribute.cs
- CryptoApi.cs
- ProfileGroupSettingsCollection.cs
- ConfigurationStrings.cs
- DebuggerAttributes.cs
- ConstantSlot.cs
- XmlSerializationGeneratedCode.cs
- UnsafeNetInfoNativeMethods.cs
- DoubleLinkList.cs
- ProxyDataContractResolver.cs
- TextDecorationLocationValidation.cs
- StrokeDescriptor.cs
- DESCryptoServiceProvider.cs
- SafeCancelMibChangeNotify.cs
- HtmlEncodedRawTextWriter.cs
- OptimalTextSource.cs
- ComponentConverter.cs
- NestPullup.cs
- KnownBoxes.cs
- SpAudioStreamWrapper.cs
- UIntPtr.cs
- COM2FontConverter.cs
- PointAnimationClockResource.cs
- ModuleConfigurationInfo.cs
- SessionIDManager.cs
- InvalidPrinterException.cs
- SafeRegistryHandle.cs
- XslCompiledTransform.cs
- XmlSchemaAnnotation.cs
- ConnectionDemuxer.cs
- Attributes.cs
- Model3DCollection.cs
- TextContainer.cs
- RemotingSurrogateSelector.cs
- ListViewInsertedEventArgs.cs
- FormatException.cs
- HtmlTableCell.cs
- SelectionRangeConverter.cs
- NumericPagerField.cs
- Timer.cs
- CodeSnippetStatement.cs
- documentsequencetextview.cs
- InvalidPropValue.cs
- BitmapFrameEncode.cs
- SrgsRule.cs
- WeakRefEnumerator.cs
- CodeExpressionRuleDeclaration.cs
- GridPattern.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- SecurityContextTokenCache.cs
- HttpStreamXmlDictionaryWriter.cs
- SpAudioStreamWrapper.cs
- DBCommand.cs
- EdmProperty.cs
- ListViewItemEventArgs.cs
- FixedSchema.cs
- ValueSerializerAttribute.cs
- GenericWebPart.cs
- DataColumnCollection.cs