Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / StringConverter.cs / 1305376 / 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
- LocatorGroup.cs
- TabControlEvent.cs
- FamilyMap.cs
- SortFieldComparer.cs
- CodeVariableDeclarationStatement.cs
- MetadataSet.cs
- DataStreams.cs
- OracleCommand.cs
- DBSchemaTable.cs
- EventArgs.cs
- WindowsAuthenticationEventArgs.cs
- CallbackValidator.cs
- TabControl.cs
- FreezableCollection.cs
- FreeFormDragDropManager.cs
- QueryContinueDragEventArgs.cs
- SoapSchemaMember.cs
- User.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- ResXResourceReader.cs
- RijndaelCryptoServiceProvider.cs
- TextElement.cs
- DefaultEvaluationContext.cs
- FontCacheUtil.cs
- RuntimeConfigLKG.cs
- XPathNavigator.cs
- ImageMap.cs
- CompoundFileStreamReference.cs
- Mutex.cs
- Parsers.cs
- BridgeDataReader.cs
- WpfMemberInvoker.cs
- CreateParams.cs
- AuthenticationModuleElement.cs
- MarshalByRefObject.cs
- XMLUtil.cs
- FileSystemInfo.cs
- WeakEventManager.cs
- Knowncolors.cs
- CodeMemberMethod.cs
- FontFaceLayoutInfo.cs
- TreeViewAutomationPeer.cs
- DefaultBinder.cs
- AstNode.cs
- PathSegment.cs
- InfoCardHelper.cs
- OpenTypeLayout.cs
- XmlSchemaProviderAttribute.cs
- EntityConnectionStringBuilder.cs
- QfeChecker.cs
- querybuilder.cs
- NewExpression.cs
- NetworkCredential.cs
- AppDomain.cs
- ObjectViewEntityCollectionData.cs
- COMException.cs
- HtmlShim.cs
- DeclaredTypeValidator.cs
- WebPartConnectionsCancelVerb.cs
- Inflater.cs
- HtmlImage.cs
- PointF.cs
- GenericUriParser.cs
- TickBar.cs
- TerminateDesigner.cs
- CodeTypeParameterCollection.cs
- DockPattern.cs
- ThreadAttributes.cs
- PagedDataSource.cs
- WebBrowserHelper.cs
- ConfigurationManagerHelper.cs
- CollectionType.cs
- CustomErrorCollection.cs
- SingletonConnectionReader.cs
- Helpers.cs
- WebResourceAttribute.cs
- DataReceivedEventArgs.cs
- Floater.cs
- XhtmlBasicCalendarAdapter.cs
- DBSqlParserColumn.cs
- UnaryNode.cs
- QilStrConcatenator.cs
- SQLDecimal.cs
- ExpandCollapsePattern.cs
- ClientEventManager.cs
- CatalogZone.cs
- TabletCollection.cs
- JsonFormatGeneratorStatics.cs
- EventDescriptor.cs
- AtlasWeb.Designer.cs
- IdentityHolder.cs
- RuleSetDialog.Designer.cs
- ColumnWidthChangedEvent.cs
- ObjectQueryState.cs
- DataServiceRequestException.cs
- IgnoreSection.cs
- SQLRoleProvider.cs
- MsmqBindingElementBase.cs
- ReferenceConverter.cs
- HtmlTextViewAdapter.cs