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
- InstanceData.cs
- StringKeyFrameCollection.cs
- StringValidator.cs
- BeginStoryboard.cs
- RoleManagerSection.cs
- XmlNode.cs
- WebReferencesBuildProvider.cs
- ListMarkerSourceInfo.cs
- ExpandSegment.cs
- XmlSigningNodeWriter.cs
- ConnectionStringSettings.cs
- Int16AnimationBase.cs
- ExtensionFile.cs
- HMACSHA384.cs
- DataMemberListEditor.cs
- SystemGatewayIPAddressInformation.cs
- StrokeDescriptor.cs
- ApplicationDirectory.cs
- QueryContinueDragEventArgs.cs
- ComplexTypeEmitter.cs
- MetadataStore.cs
- AlphabetConverter.cs
- Rfc4050KeyFormatter.cs
- WebPartMenu.cs
- StrokeRenderer.cs
- QueryCursorEventArgs.cs
- PostBackOptions.cs
- StreamHelper.cs
- CultureData.cs
- ComponentResourceKeyConverter.cs
- TimeIntervalCollection.cs
- Parser.cs
- SimpleHandlerFactory.cs
- SecurityPermission.cs
- DelegateSerializationHolder.cs
- BrushConverter.cs
- PropertyItem.cs
- ResourcesGenerator.cs
- __ConsoleStream.cs
- UnconditionalPolicy.cs
- HttpTransportBindingElement.cs
- ServiceOperationDetailViewControl.cs
- NominalTypeEliminator.cs
- UnsafeNativeMethods.cs
- DataGrid.cs
- FeatureManager.cs
- BindingCollectionElement.cs
- BlurBitmapEffect.cs
- SoapProtocolReflector.cs
- SafeFindHandle.cs
- JsonFormatReaderGenerator.cs
- SymbolTable.cs
- Symbol.cs
- wgx_commands.cs
- ContractMapping.cs
- UdpContractFilterBehavior.cs
- FieldMetadata.cs
- FloaterParagraph.cs
- DispatchWrapper.cs
- MappingException.cs
- ContentWrapperAttribute.cs
- ExternalFile.cs
- UnsafeNativeMethods.cs
- KnownTypesProvider.cs
- Reference.cs
- SoapIgnoreAttribute.cs
- PeerResolverElement.cs
- TraceContextRecord.cs
- VisualState.cs
- DateRangeEvent.cs
- TextRunCacheImp.cs
- XmlHierarchicalEnumerable.cs
- GetTokenRequest.cs
- OracleCommandBuilder.cs
- SQLInt32.cs
- XhtmlConformanceSection.cs
- CharacterMetrics.cs
- TransformDescriptor.cs
- ResXDataNode.cs
- DocumentCollection.cs
- ObjectPersistData.cs
- DirectionalLight.cs
- AppLevelCompilationSectionCache.cs
- TextTreeDeleteContentUndoUnit.cs
- BuildResultCache.cs
- TableColumn.cs
- DataGridViewSelectedRowCollection.cs
- ObjectAnimationUsingKeyFrames.cs
- InstallerTypeAttribute.cs
- GuidTagList.cs
- DataRowView.cs
- CodeParameterDeclarationExpressionCollection.cs
- ApplicationTrust.cs
- _Win32.cs
- BuildProviderAppliesToAttribute.cs
- DocumentViewer.cs
- ClientConfigurationHost.cs
- HMAC.cs
- COAUTHINFO.cs
- DataGridViewToolTip.cs