Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- FactoryMaker.cs
- RsaSecurityToken.cs
- SortDescriptionCollection.cs
- MediaTimeline.cs
- FormViewDeleteEventArgs.cs
- Image.cs
- BaseParser.cs
- PerfCounters.cs
- SqlDataSource.cs
- Vector3DKeyFrameCollection.cs
- _CommandStream.cs
- TextRangeEditTables.cs
- CollectionExtensions.cs
- ProcessThread.cs
- ExpressionTable.cs
- XmlAttributeHolder.cs
- XmlDictionaryWriter.cs
- _SslSessionsCache.cs
- DiscoveryClientDocuments.cs
- SQLDateTime.cs
- HyperLinkField.cs
- NamespaceInfo.cs
- TextBox.cs
- EpmTargetTree.cs
- StylusPoint.cs
- AuthenticatedStream.cs
- CodePrimitiveExpression.cs
- SpecialFolderEnumConverter.cs
- HtmlMeta.cs
- CryptoHelper.cs
- ColorMatrix.cs
- DataGridViewCheckBoxCell.cs
- DesignerRegionMouseEventArgs.cs
- LicenseManager.cs
- URLAttribute.cs
- AtomServiceDocumentSerializer.cs
- Debug.cs
- CodeSubDirectory.cs
- ResolveCriteria.cs
- PolicyLevel.cs
- XmlIncludeAttribute.cs
- CodeTypeMemberCollection.cs
- base64Transforms.cs
- WebPartChrome.cs
- Int32.cs
- QilTernary.cs
- EpmCustomContentWriterNodeData.cs
- XmlQueryRuntime.cs
- XmlDataSource.cs
- AppSettingsExpressionBuilder.cs
- MbpInfo.cs
- MediaCommands.cs
- PrimitiveDataContract.cs
- ToolStrip.cs
- EmptyStringExpandableObjectConverter.cs
- ConvertEvent.cs
- LayoutEditorPart.cs
- SafeSerializationManager.cs
- SocketCache.cs
- CodeGenerator.cs
- KeyValueSerializer.cs
- XmlSerializationReader.cs
- TreeNodeStyleCollection.cs
- ClientSettingsSection.cs
- ConstraintEnumerator.cs
- GridViewRow.cs
- GenericUriParser.cs
- FontSizeConverter.cs
- DrawingContextDrawingContextWalker.cs
- SearchForVirtualItemEventArgs.cs
- StaticResourceExtension.cs
- Itemizer.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- TransformGroup.cs
- WmlObjectListAdapter.cs
- Vector3DAnimationUsingKeyFrames.cs
- _ConnectOverlappedAsyncResult.cs
- ReturnValue.cs
- WsatServiceCertificate.cs
- DocumentScope.cs
- UrlMapping.cs
- RegexCompiler.cs
- AppSettingsExpressionBuilder.cs
- PropertyEmitter.cs
- HostedElements.cs
- MemoryStream.cs
- MetaType.cs
- ImportContext.cs
- FunctionNode.cs
- NullableFloatSumAggregationOperator.cs
- HttpHandlerActionCollection.cs
- CompilerGlobalScopeAttribute.cs
- EventLogRecord.cs
- DoubleAnimationUsingPath.cs
- DateRangeEvent.cs
- WebPartVerbCollection.cs
- RecommendedAsConfigurableAttribute.cs
- DesignerVerb.cs
- Connector.cs
- FileSecurity.cs