Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- Tokenizer.cs
- WebZone.cs
- IndexedEnumerable.cs
- SafeLocalAllocation.cs
- WebScriptEndpoint.cs
- ResourcesBuildProvider.cs
- UpdateCompiler.cs
- DataRecordInternal.cs
- TdsParserHelperClasses.cs
- WorkflowRuntimeServicesBehavior.cs
- CodeTypeConstructor.cs
- DocumentCollection.cs
- UntypedNullExpression.cs
- DataObjectAttribute.cs
- ProfilePropertySettingsCollection.cs
- PackagingUtilities.cs
- ListBoxItem.cs
- XmlSubtreeReader.cs
- ScriptRegistrationManager.cs
- DesigntimeLicenseContext.cs
- BlurEffect.cs
- XmlNode.cs
- RegexCharClass.cs
- StateItem.cs
- DoubleConverter.cs
- ParallelTimeline.cs
- Span.cs
- IssuanceTokenProviderState.cs
- StatusBarPanelClickEvent.cs
- InheritedPropertyChangedEventArgs.cs
- LinqDataSource.cs
- PolicyManager.cs
- MimeMapping.cs
- Encoder.cs
- GlyphRun.cs
- ProfileManager.cs
- ZipIOBlockManager.cs
- WindowsFormsSectionHandler.cs
- ProfileService.cs
- StateMachineWorkflowInstance.cs
- _OSSOCK.cs
- SubtreeProcessor.cs
- ModelItemKeyValuePair.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- MenuBase.cs
- MetadataCache.cs
- DefaultPropertyAttribute.cs
- CustomValidator.cs
- WindowHideOrCloseTracker.cs
- PolicyDesigner.cs
- ParenExpr.cs
- SamlAuthorizationDecisionStatement.cs
- WmlFormAdapter.cs
- ProbeRequestResponseAsyncResult.cs
- DocumentScope.cs
- ClusterSafeNativeMethods.cs
- HyperLinkStyle.cs
- PageThemeCodeDomTreeGenerator.cs
- ConnectionPoolManager.cs
- XmlSchemaSequence.cs
- ViewStateModeByIdAttribute.cs
- XsdBuilder.cs
- ResourcesGenerator.cs
- StringHandle.cs
- XmlSubtreeReader.cs
- IntSecurity.cs
- SqlGenericUtil.cs
- ChtmlCommandAdapter.cs
- IEnumerable.cs
- TextTrailingWordEllipsis.cs
- Renderer.cs
- DeviceContexts.cs
- OracleBoolean.cs
- TextCompositionEventArgs.cs
- SqlConnectionPoolGroupProviderInfo.cs
- IntSecurity.cs
- CollectionChangeEventArgs.cs
- FastEncoder.cs
- SystemFonts.cs
- LinkClickEvent.cs
- ListDictionary.cs
- RectAnimation.cs
- ListViewItem.cs
- DefaultIfEmptyQueryOperator.cs
- ProfileServiceManager.cs
- SqlColumnizer.cs
- OleDbException.cs
- AddingNewEventArgs.cs
- MediaContext.cs
- ValueConversionAttribute.cs
- DataListItem.cs
- ListControl.cs
- WizardSideBarListControlItemEventArgs.cs
- Visual3D.cs
- ImageListUtils.cs
- IndexerNameAttribute.cs
- ConfigurationSchemaErrors.cs
- NonVisualControlAttribute.cs
- ClientTarget.cs
- StringInfo.cs