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
- Properties.cs
- AssemblyAttributes.cs
- SqlStatistics.cs
- SqlGatherConsumedAliases.cs
- DBCommandBuilder.cs
- XmlHierarchicalDataSourceView.cs
- WorkflowApplicationUnloadedException.cs
- SQLInt64.cs
- DrawingCollection.cs
- BoolExpr.cs
- ActivityExecutionFilter.cs
- SettingsPropertyNotFoundException.cs
- ApplicationFileCodeDomTreeGenerator.cs
- SafeNativeMethods.cs
- ObjectQuery_EntitySqlExtensions.cs
- MetadataItemEmitter.cs
- EncodingNLS.cs
- HttpSessionStateWrapper.cs
- IntegerValidatorAttribute.cs
- EntitySetRetriever.cs
- DynamicMetaObject.cs
- Util.cs
- storepermissionattribute.cs
- MailMessage.cs
- TypeHelpers.cs
- XmlIterators.cs
- View.cs
- XamlReader.cs
- MD5.cs
- XmlSchemaValidator.cs
- ProcessHostServerConfig.cs
- ScriptBehaviorDescriptor.cs
- ScriptResourceHandler.cs
- ObjectConverter.cs
- Rectangle.cs
- IPPacketInformation.cs
- TrackingStringDictionary.cs
- IItemContainerGenerator.cs
- ExpressionBindings.cs
- SchemaElementLookUpTable.cs
- nulltextnavigator.cs
- Stackframe.cs
- CellNormalizer.cs
- AttachmentCollection.cs
- SelectionChangedEventArgs.cs
- ValueTypeFixupInfo.cs
- WebPartDescriptionCollection.cs
- ItemsControl.cs
- DataGridTablesFactory.cs
- WebFormsRootDesigner.cs
- TextEditorThreadLocalStore.cs
- ImageListStreamer.cs
- FontStyleConverter.cs
- TypeDescriptionProvider.cs
- DropTarget.cs
- WindowsSecurityTokenAuthenticator.cs
- StringExpressionSet.cs
- ProfileEventArgs.cs
- RSATokenProvider.cs
- TargetInvocationException.cs
- MetadataStore.cs
- MsmqNonTransactedPoisonHandler.cs
- peersecurityelement.cs
- XsltInput.cs
- HandleRef.cs
- SQlBooleanStorage.cs
- DataSourceDescriptorCollection.cs
- WindowsSecurityTokenAuthenticator.cs
- XamlTypeMapper.cs
- BooleanToVisibilityConverter.cs
- CacheVirtualItemsEvent.cs
- HttpContextWrapper.cs
- SqlInternalConnectionTds.cs
- PkcsUtils.cs
- StringStorage.cs
- SelectingProviderEventArgs.cs
- typedescriptorpermissionattribute.cs
- CharacterShapingProperties.cs
- AutoSizeComboBox.cs
- DataGridTemplateColumn.cs
- CryptoProvider.cs
- PasswordPropertyTextAttribute.cs
- MsmqIntegrationProcessProtocolHandler.cs
- DetailsViewInsertEventArgs.cs
- PeerApplicationLaunchInfo.cs
- ForEachAction.cs
- DataBinder.cs
- safelink.cs
- OdbcConnectionPoolProviderInfo.cs
- ImportCatalogPart.cs
- PolicyAssertionCollection.cs
- SqlDataSourceEnumerator.cs
- DefaultValueConverter.cs
- SupportingTokenAuthenticatorSpecification.cs
- ListComponentEditorPage.cs
- PixelFormatConverter.cs
- ExpressionPrefixAttribute.cs
- ContextDataSourceContextData.cs
- TabletCollection.cs
- AsyncPostBackErrorEventArgs.cs