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
- SortedDictionary.cs
- AsymmetricCryptoHandle.cs
- StackSpiller.Temps.cs
- RelationshipEntry.cs
- CompressionTransform.cs
- PointLightBase.cs
- Grid.cs
- DriveNotFoundException.cs
- DiscoveryVersion.cs
- TextReader.cs
- ElapsedEventArgs.cs
- SystemColorTracker.cs
- XmlAnyElementAttribute.cs
- DataGridColumnStyleMappingNameEditor.cs
- InternalTypeHelper.cs
- LabelLiteral.cs
- DbExpressionBuilder.cs
- _HTTPDateParse.cs
- TextDecorationCollection.cs
- RuntimeCompatibilityAttribute.cs
- DataGridBoolColumn.cs
- ValidationErrorInfo.cs
- DataServiceHost.cs
- ObjectStateManager.cs
- XmlnsDictionary.cs
- ListItemConverter.cs
- MessageQueuePermissionAttribute.cs
- ShaderEffect.cs
- EntityDataSourceView.cs
- ComponentEditorPage.cs
- SimpleHandlerBuildProvider.cs
- FileNameEditor.cs
- RoutedEventValueSerializer.cs
- HandlerBase.cs
- MediaElement.cs
- XmlSchemaSimpleType.cs
- NGCSerializationManager.cs
- ResXDataNode.cs
- XmlSchemaSet.cs
- DataColumnPropertyDescriptor.cs
- DependencyProperty.cs
- RestHandler.cs
- cryptoapiTransform.cs
- BlurBitmapEffect.cs
- WebServiceErrorEvent.cs
- ButtonBaseAdapter.cs
- DoubleAnimationBase.cs
- validationstate.cs
- RtfNavigator.cs
- ParameterModifier.cs
- ColorDialog.cs
- SqlUtil.cs
- BidOverLoads.cs
- cookiecontainer.cs
- messageonlyhwndwrapper.cs
- ExpressionHelper.cs
- AnimationClockResource.cs
- PropertyGridEditorPart.cs
- XmlAttributeCollection.cs
- HMACSHA1.cs
- BindingCollection.cs
- UserControl.cs
- DateBoldEvent.cs
- VectorCollectionConverter.cs
- FileSystemWatcher.cs
- StrongNameUtility.cs
- IList.cs
- SafeRightsManagementQueryHandle.cs
- NopReturnReader.cs
- DSASignatureDeformatter.cs
- ToolboxComponentsCreatedEventArgs.cs
- ContainerSelectorBehavior.cs
- FlowDocumentScrollViewer.cs
- PKCS1MaskGenerationMethod.cs
- SiteOfOriginPart.cs
- ListBoxItem.cs
- CursorConverter.cs
- SecurityPermission.cs
- KeyPressEvent.cs
- dataprotectionpermission.cs
- DBAsyncResult.cs
- CompilerWrapper.cs
- PrimitiveXmlSerializers.cs
- ReflectPropertyDescriptor.cs
- Selection.cs
- AssertUtility.cs
- RootBrowserWindow.cs
- GenerateHelper.cs
- ListSortDescription.cs
- MethodExpr.cs
- BitmapEditor.cs
- FormViewPageEventArgs.cs
- CodeAttributeArgumentCollection.cs
- TypedDatasetGenerator.cs
- ByteArrayHelperWithString.cs
- MessageDecoder.cs
- ColorConvertedBitmap.cs
- BrushConverter.cs
- XhtmlBasicCommandAdapter.cs
- JulianCalendar.cs