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
- RestHandler.cs
- QilLiteral.cs
- Brush.cs
- HtmlTernaryTree.cs
- PropertyConverter.cs
- ToolStripDropTargetManager.cs
- TraceSection.cs
- TextDecorationCollection.cs
- ScrollChangedEventArgs.cs
- CodeDelegateInvokeExpression.cs
- ActivityExecutor.cs
- XappLauncher.cs
- KeyInstance.cs
- BinaryMethodMessage.cs
- XmlSchemaObjectTable.cs
- SHA256.cs
- HandleCollector.cs
- ObjectPersistData.cs
- StatusBarPanelClickEvent.cs
- PersonalizationStateInfo.cs
- DataGridViewLinkColumn.cs
- TextAction.cs
- ClrPerspective.cs
- SqlDataSourceEnumerator.cs
- BackgroundFormatInfo.cs
- PenThreadPool.cs
- Comparer.cs
- MimeFormImporter.cs
- ReflectionPermission.cs
- SslStream.cs
- SmiTypedGetterSetter.cs
- ObjectDataSourceFilteringEventArgs.cs
- LinqDataSourceSelectEventArgs.cs
- FusionWrap.cs
- StringToken.cs
- Int64AnimationBase.cs
- OleDbDataReader.cs
- TableLayoutPanel.cs
- XmlSchemaAnnotated.cs
- ListMarkerSourceInfo.cs
- SkipStoryboardToFill.cs
- Viewport3DVisual.cs
- EmbeddedObject.cs
- SqlTypesSchemaImporter.cs
- RemotingConfiguration.cs
- SslStream.cs
- MailMessage.cs
- UnmanagedHandle.cs
- SystemParameters.cs
- Invariant.cs
- StringUtil.cs
- TiffBitmapEncoder.cs
- Bitmap.cs
- SecurityElement.cs
- ToolboxItemAttribute.cs
- XmlKeywords.cs
- DropShadowBitmapEffect.cs
- PropertyChangedEventArgs.cs
- GridViewUpdatedEventArgs.cs
- NamespaceEmitter.cs
- _SafeNetHandles.cs
- FieldToken.cs
- ByteAnimationBase.cs
- SplitContainer.cs
- RequestTimeoutManager.cs
- SafeArrayRankMismatchException.cs
- CharacterString.cs
- Clipboard.cs
- DatePickerTextBox.cs
- ConditionalExpression.cs
- QilCloneVisitor.cs
- SerializationObjectManager.cs
- XmlSignificantWhitespace.cs
- StringFormat.cs
- UnsafeNativeMethods.cs
- PaintValueEventArgs.cs
- LinkLabel.cs
- UnmanagedMemoryStream.cs
- WindowsStreamSecurityBindingElement.cs
- Psha1DerivedKeyGenerator.cs
- ColumnMap.cs
- ComPlusInstanceProvider.cs
- DataGridRowsPresenter.cs
- XmlSerializationWriter.cs
- CalendarDay.cs
- DocumentViewerBase.cs
- DLinqColumnProvider.cs
- SafeFindHandle.cs
- XmlSchemaAttribute.cs
- HWStack.cs
- PageCatalogPart.cs
- EdmItemError.cs
- DeviceFilterDictionary.cs
- EntityCommandCompilationException.cs
- RegionData.cs
- MissingMethodException.cs
- MgmtConfigurationRecord.cs
- GeometryDrawing.cs
- DBDataPermissionAttribute.cs
- Canvas.cs