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
- MediaCommands.cs
- EntityClassGenerator.cs
- UnsafeNativeMethods.cs
- XmlSignificantWhitespace.cs
- DESCryptoServiceProvider.cs
- TextBounds.cs
- SoapFaultCodes.cs
- InputLanguageManager.cs
- ComplexPropertyEntry.cs
- ObjectViewFactory.cs
- DetailsViewCommandEventArgs.cs
- XmlConvert.cs
- UpdatePanelTrigger.cs
- IRCollection.cs
- MimeWriter.cs
- DataChangedEventManager.cs
- SqlDependencyListener.cs
- ToolStripHighContrastRenderer.cs
- PathFigureCollectionValueSerializer.cs
- RsaKeyGen.cs
- Token.cs
- RadioButtonRenderer.cs
- AspNetSynchronizationContext.cs
- OrderedDictionaryStateHelper.cs
- SqlServices.cs
- TitleStyle.cs
- MenuItemCollection.cs
- CharAnimationBase.cs
- AutomationAttributeInfo.cs
- RadioButton.cs
- _ConnectOverlappedAsyncResult.cs
- BaseDataList.cs
- ImageAttributes.cs
- SecureUICommand.cs
- ConfigXmlReader.cs
- mediaeventargs.cs
- ToolboxItemFilterAttribute.cs
- XmlDomTextWriter.cs
- ObjRef.cs
- ValidationErrorInfo.cs
- ConfigurationValues.cs
- MonthChangedEventArgs.cs
- KeySplineConverter.cs
- MatrixTransform.cs
- SqlCacheDependencySection.cs
- ProtectedConfigurationSection.cs
- ValidationErrorInfo.cs
- TextBox.cs
- ServiceAuthorizationManager.cs
- SystemDiagnosticsSection.cs
- MessageQueueEnumerator.cs
- Oid.cs
- PerspectiveCamera.cs
- PathNode.cs
- MultiSelector.cs
- InfoCardSymmetricAlgorithm.cs
- SqlDataSourceStatusEventArgs.cs
- ExpressionBindings.cs
- ExeConfigurationFileMap.cs
- DbConnectionPoolCounters.cs
- ImplicitInputBrush.cs
- CodeTryCatchFinallyStatement.cs
- SiteMapNodeItem.cs
- ModuleBuilder.cs
- PointConverter.cs
- SrgsSemanticInterpretationTag.cs
- QueryContinueDragEventArgs.cs
- XmlSerializer.cs
- ClientTargetCollection.cs
- HybridDictionary.cs
- SplitterEvent.cs
- Pair.cs
- RangeBase.cs
- XmlParserContext.cs
- LogSwitch.cs
- TimeSpan.cs
- KeyboardEventArgs.cs
- cookieexception.cs
- OpacityConverter.cs
- SecurityState.cs
- SHA384Managed.cs
- Model3D.cs
- RecognizerBase.cs
- InvalidPipelineStoreException.cs
- BufferedMessageData.cs
- DateTime.cs
- SingleTagSectionHandler.cs
- UInt64Storage.cs
- XmlSchemaChoice.cs
- Matrix3D.cs
- ListChunk.cs
- ThemeDirectoryCompiler.cs
- ProjectionPathSegment.cs
- HwndSourceParameters.cs
- MgmtResManager.cs
- XmlNodeComparer.cs
- SystemNetworkInterface.cs
- TaskFormBase.cs
- BodyWriter.cs
- Random.cs