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
- SurrogateSelector.cs
- DataGridViewLayoutData.cs
- PerfCounterSection.cs
- LambdaCompiler.Expressions.cs
- GridViewDeleteEventArgs.cs
- DBConnection.cs
- ClientScriptManager.cs
- ISFTagAndGuidCache.cs
- XmlSchemaIdentityConstraint.cs
- PresentationAppDomainManager.cs
- ResXDataNode.cs
- EventRouteFactory.cs
- PreloadedPackages.cs
- TextTreeRootTextBlock.cs
- DataServiceQueryOfT.cs
- SiteMap.cs
- ALinqExpressionVisitor.cs
- Screen.cs
- CompositeFontParser.cs
- TextParagraph.cs
- WaitHandleCannotBeOpenedException.cs
- DrawToolTipEventArgs.cs
- CodeTypeReferenceExpression.cs
- CalendarDateChangedEventArgs.cs
- SharedPerformanceCounter.cs
- LoginUtil.cs
- ApplicationServiceManager.cs
- BehaviorEditorPart.cs
- CriticalFinalizerObject.cs
- Matrix.cs
- WebPart.cs
- TiffBitmapDecoder.cs
- DocComment.cs
- GuidConverter.cs
- DoubleAnimationClockResource.cs
- ControlCachePolicy.cs
- GradientBrush.cs
- SqlTriggerContext.cs
- ListBindableAttribute.cs
- XmlDomTextWriter.cs
- PeerMaintainer.cs
- HotSpot.cs
- CapabilitiesPattern.cs
- ScriptControlManager.cs
- ManifestResourceInfo.cs
- PersonalizationStateInfoCollection.cs
- DEREncoding.cs
- CheckBoxRenderer.cs
- ToolboxItem.cs
- Control.cs
- InitiatorServiceModelSecurityTokenRequirement.cs
- Menu.cs
- VerifyHashRequest.cs
- ToolStripOverflow.cs
- ResourceContainer.cs
- MetadataArtifactLoaderFile.cs
- ProtectedProviderSettings.cs
- EnumBuilder.cs
- HttpContextWrapper.cs
- QilXmlReader.cs
- ResourceAttributes.cs
- Rotation3DAnimation.cs
- StronglyTypedResourceBuilder.cs
- initElementDictionary.cs
- Authorization.cs
- SafeBitVector32.cs
- FormViewCommandEventArgs.cs
- RecipientInfo.cs
- ContainerUIElement3D.cs
- AddInAdapter.cs
- StreamGeometry.cs
- ProfileBuildProvider.cs
- Decoder.cs
- DbMetaDataColumnNames.cs
- AnimationLayer.cs
- TemplateField.cs
- AppSettingsExpressionBuilder.cs
- JoinTreeSlot.cs
- TreeSet.cs
- RunClient.cs
- CheckBoxPopupAdapter.cs
- Module.cs
- GlobalProxySelection.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- GridView.cs
- ForAllOperator.cs
- CommandManager.cs
- EventLogEntryCollection.cs
- ScriptingProfileServiceSection.cs
- Stacktrace.cs
- MultipartContentParser.cs
- Peer.cs
- Helpers.cs
- ExpressionVisitor.cs
- TextElement.cs
- SchemeSettingElementCollection.cs
- ImmutableCollection.cs
- ComponentSerializationService.cs
- ReadingWritingEntityEventArgs.cs
- StronglyTypedResourceBuilder.cs