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
- SystemColorTracker.cs
- SafeIUnknown.cs
- RelationshipFixer.cs
- ValidationException.cs
- AdornerPresentationContext.cs
- WebServiceBindingAttribute.cs
- Translator.cs
- SapiRecoInterop.cs
- mediaeventshelper.cs
- ConfigurationPropertyAttribute.cs
- RoleGroupCollection.cs
- TimeSpanMinutesConverter.cs
- TransactionProtocolConverter.cs
- ColumnBinding.cs
- ObjectFullSpanRewriter.cs
- SecurityContext.cs
- ContextBase.cs
- BufferModeSettings.cs
- Crc32.cs
- Grammar.cs
- EffectiveValueEntry.cs
- HttpResponseHeader.cs
- TreeNode.cs
- TextTreeTextBlock.cs
- ExpressionConverter.cs
- SafeMemoryMappedFileHandle.cs
- ProxyOperationRuntime.cs
- ClickablePoint.cs
- CaseExpr.cs
- WpfGeneratedKnownTypes.cs
- HttpMethodConstraint.cs
- WindowsListViewSubItem.cs
- TraceContextRecord.cs
- DataSourceView.cs
- _SpnDictionary.cs
- DSASignatureFormatter.cs
- ActivityMarkupSerializationProvider.cs
- StylusPointCollection.cs
- EventLogTraceListener.cs
- DbReferenceCollection.cs
- FixedSOMTable.cs
- XmlArrayAttribute.cs
- ConnectionsZone.cs
- SynchronousChannel.cs
- DatagridviewDisplayedBandsData.cs
- DataGridSortCommandEventArgs.cs
- Cell.cs
- FixedBufferAttribute.cs
- WebException.cs
- FixedSOMLineRanges.cs
- NotImplementedException.cs
- NumberFormatInfo.cs
- SoapIncludeAttribute.cs
- SystemResources.cs
- WebPartCatalogAddVerb.cs
- TextElementEnumerator.cs
- DependencyPropertyKind.cs
- LambdaExpression.cs
- EventSinkActivityDesigner.cs
- OracleDataAdapter.cs
- MetadataArtifactLoaderFile.cs
- DbConnectionPoolIdentity.cs
- Visual.cs
- DoubleLinkList.cs
- HyperLinkColumn.cs
- SynchronizedDispatch.cs
- Expressions.cs
- util.cs
- PageParserFilter.cs
- StylusPointDescription.cs
- EntityClassGenerator.cs
- DisplayInformation.cs
- LoadRetryStrategyFactory.cs
- ListenerElementsCollection.cs
- ConfigurationValue.cs
- UpdateTracker.cs
- TextParagraphProperties.cs
- OutputScopeManager.cs
- CodeCommentStatement.cs
- PlatformCulture.cs
- TemplatedMailWebEventProvider.cs
- OleDbDataAdapter.cs
- SerialErrors.cs
- DesignerAutoFormat.cs
- OutKeywords.cs
- SecurityManager.cs
- DataGridViewCellStyle.cs
- SoapAttributeAttribute.cs
- HtmlFormAdapter.cs
- SimplePropertyEntry.cs
- SqlXmlStorage.cs
- NavigateEvent.cs
- InheritedPropertyChangedEventArgs.cs
- PenContext.cs
- HtmlContainerControl.cs
- _SslSessionsCache.cs
- StylusPointPropertyUnit.cs
- _UriSyntax.cs
- RTLAwareMessageBox.cs
- ListParagraph.cs