Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- SharedConnectionWorkflowTransactionService.cs
- InputLanguageSource.cs
- Win32Exception.cs
- HtmlInputText.cs
- Socket.cs
- MenuRenderer.cs
- KeyPressEvent.cs
- DependencyObjectType.cs
- HostExecutionContextManager.cs
- BasicKeyConstraint.cs
- BindingValueChangedEventArgs.cs
- StorageAssociationSetMapping.cs
- HttpWebResponse.cs
- _AcceptOverlappedAsyncResult.cs
- SafeEventLogWriteHandle.cs
- AssertFilter.cs
- DynamicValidator.cs
- MatrixValueSerializer.cs
- TrustManager.cs
- StringInfo.cs
- MaskedTextBoxTextEditor.cs
- AssociationType.cs
- PasswordBoxAutomationPeer.cs
- GridViewCommandEventArgs.cs
- BooleanFacetDescriptionElement.cs
- Quad.cs
- DbConnectionPool.cs
- ParameterElementCollection.cs
- ConstructorExpr.cs
- PointLight.cs
- GeneralTransformGroup.cs
- StandardOleMarshalObject.cs
- UICuesEvent.cs
- HighlightComponent.cs
- ThicknessKeyFrameCollection.cs
- DateTime.cs
- SchemaType.cs
- DecoderNLS.cs
- XmlElement.cs
- ApplicationSettingsBase.cs
- ChannelManagerHelpers.cs
- StaticExtension.cs
- AssemblyAttributesGoHere.cs
- ISO2022Encoding.cs
- SmiMetaData.cs
- Tile.cs
- HybridDictionary.cs
- SupportingTokenParameters.cs
- CommonGetThemePartSize.cs
- PathSegment.cs
- RectangleF.cs
- HostVisual.cs
- ServiceHttpModule.cs
- ProxyGenerator.cs
- WebPartCatalogAddVerb.cs
- RectAnimationClockResource.cs
- HtmlDocument.cs
- Image.cs
- EventDescriptorCollection.cs
- TextRunCacheImp.cs
- CommandLibraryHelper.cs
- PenLineJoinValidation.cs
- Debug.cs
- DataServiceClientException.cs
- DropSource.cs
- DataGridPageChangedEventArgs.cs
- PageThemeBuildProvider.cs
- RegexRunner.cs
- Matrix3D.cs
- XmlWrappingReader.cs
- AnnotationObservableCollection.cs
- XamlWriter.cs
- CharacterMetricsDictionary.cs
- ToolBar.cs
- XmlWhitespace.cs
- ReadOnlyCollection.cs
- XmlIncludeAttribute.cs
- TemplateInstanceAttribute.cs
- StringResourceManager.cs
- DashStyle.cs
- ObjectDataSourceFilteringEventArgs.cs
- TokenizerHelper.cs
- LinkedResourceCollection.cs
- BaseCollection.cs
- AppSettingsExpressionEditor.cs
- WebPartPersonalization.cs
- Imaging.cs
- ServicePointManager.cs
- TextDocumentView.cs
- SrgsRule.cs
- SiteMapPath.cs
- SQLBytes.cs
- CompilationRelaxations.cs
- MatrixTransform.cs
- RuleEngine.cs
- AnimatedTypeHelpers.cs
- TdsEnums.cs
- PropertyPath.cs
- RegexBoyerMoore.cs
- TabPanel.cs