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
- HealthMonitoringSection.cs
- NonParentingControl.cs
- FileDialogCustomPlacesCollection.cs
- AllMembershipCondition.cs
- Evidence.cs
- MultipartContentParser.cs
- WindowsIPAddress.cs
- DoubleLinkList.cs
- BindingManagerDataErrorEventArgs.cs
- ListItemViewControl.cs
- MarshalByRefObject.cs
- Timer.cs
- xmlglyphRunInfo.cs
- ProcessHostMapPath.cs
- SafeArrayRankMismatchException.cs
- arc.cs
- ClientSponsor.cs
- MessageEncoderFactory.cs
- WebControlsSection.cs
- Token.cs
- ELinqQueryState.cs
- WindowsFont.cs
- LogExtent.cs
- WindowsScroll.cs
- ItemsPanelTemplate.cs
- MachineSettingsSection.cs
- OTFRasterizer.cs
- CryptographicAttribute.cs
- HttpResponseInternalBase.cs
- Message.cs
- DetailsViewInsertEventArgs.cs
- GeometryDrawing.cs
- WebExceptionStatus.cs
- ProxyElement.cs
- GridViewDeleteEventArgs.cs
- WebHeaderCollection.cs
- CompositeKey.cs
- GuidConverter.cs
- ExtensionSurface.cs
- EdgeProfileValidation.cs
- ChtmlCommandAdapter.cs
- OracleRowUpdatingEventArgs.cs
- XmlSchemaRedefine.cs
- SafeEventLogWriteHandle.cs
- ToolStripSettings.cs
- SqlDataAdapter.cs
- ServicePoint.cs
- Soap12FormatExtensions.cs
- BamlLocalizableResource.cs
- DSACryptoServiceProvider.cs
- ErrorRuntimeConfig.cs
- OpenFileDialog.cs
- TableColumn.cs
- XmlAnyElementAttributes.cs
- NamespaceMapping.cs
- OperationFormatStyle.cs
- EventLogPermissionEntryCollection.cs
- ListBindingConverter.cs
- FloatMinMaxAggregationOperator.cs
- FormViewInsertEventArgs.cs
- TextProviderWrapper.cs
- SqlTopReducer.cs
- BoundingRectTracker.cs
- MetadataItem_Static.cs
- IsolationInterop.cs
- SortedDictionary.cs
- TextSerializer.cs
- ProxyHwnd.cs
- BasicAsyncResult.cs
- ProcessInputEventArgs.cs
- Int64KeyFrameCollection.cs
- FormsAuthenticationUser.cs
- EventData.cs
- AffineTransform3D.cs
- WindowsImpersonationContext.cs
- RuleDefinitions.cs
- ObservableCollection.cs
- MetadataArtifactLoaderFile.cs
- DesigntimeLicenseContextSerializer.cs
- OleDbDataAdapter.cs
- AnimationClock.cs
- PreloadedPackages.cs
- ObjectDataSourceStatusEventArgs.cs
- HashSet.cs
- FieldMetadata.cs
- DbConnectionOptions.cs
- BaseTemplateParser.cs
- XmlDomTextWriter.cs
- CodeCatchClause.cs
- CreateParams.cs
- GatewayIPAddressInformationCollection.cs
- FixedFindEngine.cs
- Triplet.cs
- AutoResetEvent.cs
- XmlSchemaAnnotation.cs
- DesignerSerializerAttribute.cs
- Char.cs
- WinFormsSpinner.cs
- SinglePageViewer.cs
- ToolStripRenderEventArgs.cs