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
- XmlSchemaFacet.cs
- DelegateSerializationHolder.cs
- WCFBuildProvider.cs
- ProbeMatchesApril2005.cs
- Int32KeyFrameCollection.cs
- Vector3DCollectionConverter.cs
- ExpiredSecurityTokenException.cs
- TimeSpanValidatorAttribute.cs
- XmlDataSourceView.cs
- AliasGenerator.cs
- CrossSiteScriptingValidation.cs
- WebPartZoneAutoFormat.cs
- CreateWorkflowOwnerCommand.cs
- compensatingcollection.cs
- SqlGatherConsumedAliases.cs
- SQLBoolean.cs
- OneToOneMappingSerializer.cs
- ErrorWebPart.cs
- HijriCalendar.cs
- DataGridViewCellStyle.cs
- FormViewDesigner.cs
- SegmentTree.cs
- Process.cs
- HttpModuleActionCollection.cs
- WebEvents.cs
- ADMembershipUser.cs
- PolicyStatement.cs
- LinqDataSourceDisposeEventArgs.cs
- RoamingStoreFile.cs
- SecurityPolicySection.cs
- StructuralObject.cs
- AnnotationDocumentPaginator.cs
- FreezableOperations.cs
- DataGridViewCellStyleConverter.cs
- DataMemberConverter.cs
- StringComparer.cs
- MarkupExtensionParser.cs
- Activation.cs
- HwndSourceParameters.cs
- SqlNotificationEventArgs.cs
- AsyncOperationManager.cs
- ItemsControl.cs
- FileChangesMonitor.cs
- PriorityRange.cs
- ProtocolState.cs
- ScrollProviderWrapper.cs
- PropertyGeneratedEventArgs.cs
- DataMemberFieldEditor.cs
- HttpRawResponse.cs
- MailMessage.cs
- DiscoveryClientOutputChannel.cs
- TabItemAutomationPeer.cs
- Stylesheet.cs
- XmlEntity.cs
- DbCommandTree.cs
- HtmlInputReset.cs
- DebugHandleTracker.cs
- BindableTemplateBuilder.cs
- WindowsListViewItemStartMenu.cs
- MetafileHeader.cs
- SqlDataSourceConfigureFilterForm.cs
- Operator.cs
- SafeLibraryHandle.cs
- QilInvokeLateBound.cs
- ActivityStateQuery.cs
- PrintDocument.cs
- cache.cs
- SHA384CryptoServiceProvider.cs
- XmlQueryRuntime.cs
- ToolStripMenuItemDesigner.cs
- PackagePart.cs
- Typeface.cs
- TextMarkerSource.cs
- SHA384Managed.cs
- TiffBitmapDecoder.cs
- BinaryReader.cs
- PerfService.cs
- Panel.cs
- ProtocolViolationException.cs
- TextDecoration.cs
- BaseDataList.cs
- PointCollectionConverter.cs
- MetadataArtifactLoader.cs
- HttpCachePolicyElement.cs
- CodeCompileUnit.cs
- WorkflowApplicationException.cs
- Activity.cs
- Rijndael.cs
- AssemblyInfo.cs
- Animatable.cs
- rsa.cs
- CollectionViewGroupRoot.cs
- ExpandCollapseProviderWrapper.cs
- SqlFacetAttribute.cs
- ThicknessAnimationBase.cs
- InvalidFilterCriteriaException.cs
- GridEntryCollection.cs
- localization.cs
- SingleStorage.cs
- _HeaderInfo.cs