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
- FamilyMap.cs
- RoleManagerEventArgs.cs
- LineInfo.cs
- PrivilegeNotHeldException.cs
- XmlWriterTraceListener.cs
- SamlAdvice.cs
- TokenBasedSetEnumerator.cs
- ReliabilityContractAttribute.cs
- ping.cs
- Renderer.cs
- ItemsPresenter.cs
- SerialPort.cs
- SimpleRecyclingCache.cs
- TypeDelegator.cs
- BrowserTree.cs
- XmlValidatingReaderImpl.cs
- KeyEventArgs.cs
- LoginNameDesigner.cs
- HtmlForm.cs
- LiteralSubsegment.cs
- EmptyEnumerable.cs
- DelayedRegex.cs
- OptionUsage.cs
- CodeChecksumPragma.cs
- BindingOperations.cs
- HtmlAnchor.cs
- BitmapEffectInputData.cs
- HtmlEmptyTagControlBuilder.cs
- GridViewHeaderRowPresenter.cs
- Constants.cs
- ComEventsSink.cs
- DecimalConstantAttribute.cs
- ListManagerBindingsCollection.cs
- TextBox.cs
- CompositeActivityMarkupSerializer.cs
- SelectionRange.cs
- StylusPlugInCollection.cs
- CurrentChangingEventManager.cs
- Selection.cs
- VisualTreeHelper.cs
- TreeNodeCollectionEditor.cs
- ProfileSettingsCollection.cs
- ContentControl.cs
- SafeSecurityHelper.cs
- PackageRelationship.cs
- RegexWriter.cs
- InsufficientMemoryException.cs
- TextBoxDesigner.cs
- HwndProxyElementProvider.cs
- BulletChrome.cs
- brushes.cs
- ToolBarOverflowPanel.cs
- SQLSingle.cs
- HttpServerVarsCollection.cs
- DrawingState.cs
- mediaeventargs.cs
- SqlRemoveConstantOrderBy.cs
- LicenseContext.cs
- SerializationUtility.cs
- OracleEncoding.cs
- StylusButtonEventArgs.cs
- CultureInfoConverter.cs
- PcmConverter.cs
- XmlExtensionFunction.cs
- _RequestCacheProtocol.cs
- QilVisitor.cs
- CollectionView.cs
- ContextProperty.cs
- ConfigurationValidatorAttribute.cs
- ErrorTableItemStyle.cs
- ResXBuildProvider.cs
- HttpConfigurationContext.cs
- wgx_render.cs
- GeometryHitTestParameters.cs
- CompositeCollectionView.cs
- AttributeConverter.cs
- TimeStampChecker.cs
- Image.cs
- SkipStoryboardToFill.cs
- ExpressionNode.cs
- XmlAutoDetectWriter.cs
- JournalEntryStack.cs
- ReaderOutput.cs
- EmptyElement.cs
- MetadataArtifactLoaderCompositeResource.cs
- FormViewRow.cs
- WebPartConnectionsConnectVerb.cs
- XmlSortKey.cs
- NoneExcludedImageIndexConverter.cs
- LockCookie.cs
- WorkflowOperationAsyncResult.cs
- TextDecorationLocationValidation.cs
- ComplexBindingPropertiesAttribute.cs
- MgmtConfigurationRecord.cs
- WinInet.cs
- _FtpControlStream.cs
- ListItemsPage.cs
- ContextProperty.cs
- ProtectedConfiguration.cs
- Vector3dCollection.cs