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
- GetParentChain.cs
- CryptoHelper.cs
- Typeface.cs
- WindowsListViewItem.cs
- CoreSwitches.cs
- BaseTypeViewSchema.cs
- URLIdentityPermission.cs
- CommandEventArgs.cs
- TextAdaptor.cs
- httpstaticobjectscollection.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- MapPathBasedVirtualPathProvider.cs
- ZoneMembershipCondition.cs
- PageStatePersister.cs
- _FtpControlStream.cs
- HtmlString.cs
- MatrixValueSerializer.cs
- ResourceExpressionEditorSheet.cs
- ServiceOperationParameter.cs
- DecimalAnimation.cs
- PageScaling.cs
- SetterBaseCollection.cs
- SymmetricSecurityProtocol.cs
- RegistryPermission.cs
- DataKey.cs
- BoundField.cs
- HttpInputStream.cs
- DesignObjectWrapper.cs
- DataServiceResponse.cs
- MetadataAssemblyHelper.cs
- ReaderOutput.cs
- DataSourceSerializationException.cs
- EntityViewContainer.cs
- KeyConverter.cs
- ExpressionBuilder.cs
- HMACMD5.cs
- SystemIPInterfaceProperties.cs
- CharacterMetrics.cs
- ImageBrush.cs
- CompiledELinqQueryState.cs
- CapabilitiesUse.cs
- ResolvedKeyFrameEntry.cs
- FeatureSupport.cs
- IsolationInterop.cs
- DataSvcMapFile.cs
- SupportsEventValidationAttribute.cs
- ApplicationProxyInternal.cs
- AttachedAnnotationChangedEventArgs.cs
- NativeMethods.cs
- ConsoleTraceListener.cs
- UnsafeNativeMethodsCLR.cs
- KeyValuePairs.cs
- XmlSchemaSimpleContent.cs
- HostingEnvironment.cs
- ToolBarButton.cs
- SmtpSection.cs
- TableLayoutPanelCellPosition.cs
- SystemGatewayIPAddressInformation.cs
- ByteStack.cs
- XmlSiteMapProvider.cs
- DBDataPermissionAttribute.cs
- TransformGroup.cs
- TdsParser.cs
- GlobalItem.cs
- LocalizedNameDescriptionPair.cs
- FullTextBreakpoint.cs
- WorkflowTransactionOptions.cs
- DictionarySurrogate.cs
- InfocardClientCredentials.cs
- Frame.cs
- TextParaLineResult.cs
- CellCreator.cs
- SymbolType.cs
- WebPartMinimizeVerb.cs
- NonBatchDirectoryCompiler.cs
- uribuilder.cs
- ListView.cs
- ButtonFieldBase.cs
- FixedSOMSemanticBox.cs
- SingleObjectCollection.cs
- SmiGettersStream.cs
- GeneralTransform3DGroup.cs
- ImageSource.cs
- AppSettingsReader.cs
- DispatcherOperation.cs
- DataGridViewRowPostPaintEventArgs.cs
- BitmapCodecInfo.cs
- ItemsControlAutomationPeer.cs
- DocumentSchemaValidator.cs
- HostingEnvironmentSection.cs
- ProcessModuleCollection.cs
- StructuralCache.cs
- Maps.cs
- MasterPageParser.cs
- TextSelectionHighlightLayer.cs
- TraceHandlerErrorFormatter.cs
- DataKey.cs
- OletxTransactionFormatter.cs
- CustomLineCap.cs
- CounterCreationDataCollection.cs