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
- GridViewAutomationPeer.cs
- ValueQuery.cs
- MobileContainerDesigner.cs
- ClientFormsIdentity.cs
- XmlBinaryReader.cs
- BaseTemplateCodeDomTreeGenerator.cs
- KeyboardInputProviderAcquireFocusEventArgs.cs
- XmlSchemaDocumentation.cs
- PackagePart.cs
- InitiatorServiceModelSecurityTokenRequirement.cs
- Helpers.cs
- XmlDataProvider.cs
- SecurityHelper.cs
- EntityTypeEmitter.cs
- PermissionListSet.cs
- ObjectSecurity.cs
- SystemColorTracker.cs
- XmlNullResolver.cs
- CodeDOMProvider.cs
- PeerResolver.cs
- ObjectCache.cs
- __Error.cs
- RestHandler.cs
- XmlCharType.cs
- DbParameterHelper.cs
- PopupEventArgs.cs
- XmlImplementation.cs
- DeviceOverridableAttribute.cs
- MediaEntryAttribute.cs
- SizeConverter.cs
- AudioException.cs
- OverrideMode.cs
- __ConsoleStream.cs
- CodeIterationStatement.cs
- Int32Rect.cs
- GcSettings.cs
- Annotation.cs
- TextPenaltyModule.cs
- TrustLevelCollection.cs
- Axis.cs
- IpcChannelHelper.cs
- Scheduling.cs
- Comparer.cs
- ToolStripDropDownDesigner.cs
- TypeInformation.cs
- XmlQueryCardinality.cs
- GlobalizationAssembly.cs
- GridLength.cs
- DoubleConverter.cs
- RequestedSignatureDialog.cs
- TimeSpanStorage.cs
- Material.cs
- CustomError.cs
- TreeNodeCollection.cs
- CodeStatement.cs
- NameValueCollection.cs
- TransportContext.cs
- DiscoveryDocumentSerializer.cs
- Activator.cs
- MemberHolder.cs
- EditorZoneBase.cs
- BinaryUtilClasses.cs
- DropTarget.cs
- __Filters.cs
- CompilerParameters.cs
- MarkupObject.cs
- PageFunction.cs
- CommandDesigner.cs
- TagNameToTypeMapper.cs
- Stylesheet.cs
- VideoDrawing.cs
- ConnectionConsumerAttribute.cs
- StrokeCollectionConverter.cs
- SecurityPermission.cs
- SqlUdtInfo.cs
- KeyMatchBuilder.cs
- DataGridViewCellValueEventArgs.cs
- ReferenceEqualityComparer.cs
- Thread.cs
- TextFormatter.cs
- DataBoundControlAdapter.cs
- BamlRecordHelper.cs
- DesignObjectWrapper.cs
- SelectionPattern.cs
- ControlCachePolicy.cs
- SystemMulticastIPAddressInformation.cs
- SettingsPropertyValue.cs
- HtmlElementErrorEventArgs.cs
- WeakRefEnumerator.cs
- SqlNode.cs
- DispatcherHooks.cs
- EntityDataSourceDataSelection.cs
- HttpWebRequest.cs
- BitmapEffectInput.cs
- HttpsTransportElement.cs
- ScrollViewerAutomationPeer.cs
- HttpListenerContext.cs
- BitmapSizeOptions.cs
- Stackframe.cs
- CustomSignedXml.cs