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
- FormsAuthenticationUserCollection.cs
- JournalEntry.cs
- DesignerCapabilities.cs
- DataGridViewCellContextMenuStripNeededEventArgs.cs
- DeclarativeCatalogPart.cs
- UInt64Storage.cs
- VolatileEnlistmentState.cs
- Formatter.cs
- XmlBaseWriter.cs
- ReadOnlyHierarchicalDataSourceView.cs
- serverconfig.cs
- HijriCalendar.cs
- SiteMapPath.cs
- SrgsDocument.cs
- Speller.cs
- SchemaImporterExtensionElement.cs
- StylusCollection.cs
- SizeFConverter.cs
- WSFederationHttpBindingCollectionElement.cs
- TextReader.cs
- ExecutionEngineException.cs
- ModelPropertyDescriptor.cs
- LongMinMaxAggregationOperator.cs
- TemplatePagerField.cs
- SettingsBase.cs
- ParameterCollection.cs
- XmlChoiceIdentifierAttribute.cs
- RepeatBehavior.cs
- InstancePersistenceContext.cs
- DataRelationCollection.cs
- SerializationHelper.cs
- GeneralTransform3D.cs
- _NegotiateClient.cs
- TripleDESCryptoServiceProvider.cs
- ToolStripDropDownMenu.cs
- SafeThreadHandle.cs
- StylusShape.cs
- Icon.cs
- XmlSchemaDatatype.cs
- ToolConsole.cs
- DrawingGroup.cs
- Style.cs
- XslAstAnalyzer.cs
- Table.cs
- ACE.cs
- ReliableSessionBindingElement.cs
- RenderOptions.cs
- TemplatePartAttribute.cs
- DataGridViewColumnHeaderCell.cs
- ConfigurationPermission.cs
- safex509handles.cs
- EntityParameterCollection.cs
- _WinHttpWebProxyDataBuilder.cs
- BCLDebug.cs
- OnOperation.cs
- WebPartMovingEventArgs.cs
- OpacityConverter.cs
- CodeTypeOfExpression.cs
- X509AsymmetricSecurityKey.cs
- SharedUtils.cs
- ProxySimple.cs
- SizeConverter.cs
- WebChannelFactory.cs
- SQLInt16.cs
- StaticFileHandler.cs
- ConfigurationCollectionAttribute.cs
- SystemIPv6InterfaceProperties.cs
- SymLanguageVendor.cs
- MaskedTextProvider.cs
- JsonWriter.cs
- HttpHandlerAction.cs
- OdbcException.cs
- RelationshipEndMember.cs
- ToolStripPanelRenderEventArgs.cs
- ColorComboBox.cs
- TreeViewItem.cs
- PseudoWebRequest.cs
- TypeSystem.cs
- Stream.cs
- SqlFlattener.cs
- CaseStatement.cs
- ServiceDescriptions.cs
- FontStyles.cs
- TableAdapterManagerMethodGenerator.cs
- ServiceModelActivity.cs
- BitmapMetadataBlob.cs
- NetworkCredential.cs
- SwitchAttribute.cs
- DockPattern.cs
- XsdDuration.cs
- ToolStripDropTargetManager.cs
- ObjectViewListener.cs
- Site.cs
- HideDisabledControlAdapter.cs
- SqlStream.cs
- ConfigurationValidatorAttribute.cs
- DetailsViewRowCollection.cs
- TextFormatter.cs
- HelpPage.cs
- ConsoleCancelEventArgs.cs