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
- ProcessModule.cs
- SpotLight.cs
- ParentUndoUnit.cs
- XmlRawWriter.cs
- DataControlCommands.cs
- HtmlTitle.cs
- UnmanagedHandle.cs
- GestureRecognitionResult.cs
- DbConnectionPoolOptions.cs
- NumericExpr.cs
- WindowsFormsSectionHandler.cs
- Span.cs
- TypeDelegator.cs
- DataServiceHostFactory.cs
- TreeNode.cs
- HttpRequest.cs
- TerminateSequenceResponse.cs
- IgnorePropertiesAttribute.cs
- ColorPalette.cs
- DesignerProperties.cs
- RangeValuePatternIdentifiers.cs
- EditingMode.cs
- JoinGraph.cs
- GuidTagList.cs
- EventItfInfo.cs
- MetadataCollection.cs
- Margins.cs
- EditorBrowsableAttribute.cs
- FindCriteria.cs
- SelfIssuedTokenFactoryCredential.cs
- MdImport.cs
- ZipIOCentralDirectoryBlock.cs
- Control.cs
- PeerNameRecord.cs
- RegexReplacement.cs
- HtmlInputText.cs
- SmtpTransport.cs
- SequentialUshortCollection.cs
- returneventsaver.cs
- Polygon.cs
- BamlRecordWriter.cs
- GroupBox.cs
- Image.cs
- RichTextBoxDesigner.cs
- ExtendedPropertyCollection.cs
- StdValidatorsAndConverters.cs
- EntityDataSourceWizardForm.cs
- MetadataItem.cs
- Viewport2DVisual3D.cs
- ClusterRegistryConfigurationProvider.cs
- ApplicationSecurityManager.cs
- TreeViewBindingsEditor.cs
- MappingModelBuildProvider.cs
- SemaphoreSecurity.cs
- ClickablePoint.cs
- DataControlPagerLinkButton.cs
- NavigationCommands.cs
- MonikerUtility.cs
- HotSpot.cs
- CompoundFileReference.cs
- CounterSampleCalculator.cs
- WebPartConnectionsCancelVerb.cs
- Compilation.cs
- EventProvider.cs
- TimeSpanMinutesConverter.cs
- KeyMatchBuilder.cs
- DataServiceContext.cs
- AgileSafeNativeMemoryHandle.cs
- WindowsToolbar.cs
- VectorValueSerializer.cs
- CodeTypeMember.cs
- RecordsAffectedEventArgs.cs
- ControlBuilderAttribute.cs
- NextPreviousPagerField.cs
- IIS7WorkerRequest.cs
- LayoutEvent.cs
- WebZone.cs
- FixedSOMLineRanges.cs
- RegistrationServices.cs
- IRCollection.cs
- AnimationClock.cs
- DataGridToolTip.cs
- Size3D.cs
- StoreAnnotationsMap.cs
- CompilerCollection.cs
- MetaModel.cs
- LinqDataView.cs
- MiniParameterInfo.cs
- GridViewRowPresenter.cs
- SymbolTable.cs
- TrailingSpaceComparer.cs
- DataViewListener.cs
- RegexRunnerFactory.cs
- HttpModuleActionCollection.cs
- cookiecollection.cs
- UdpMessageProperty.cs
- WebServicesInteroperability.cs
- IsolatedStorageFileStream.cs
- SqlNotificationEventArgs.cs
- XmlReflectionImporter.cs