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
- CuspData.cs
- OnOperation.cs
- InstancePersistenceContext.cs
- ResourceReferenceExpression.cs
- GridViewRowPresenterBase.cs
- XpsFilter.cs
- EntityFunctions.cs
- ContentIterators.cs
- DataServiceExpressionVisitor.cs
- Symbol.cs
- TextContainer.cs
- MultidimensionalArrayItemReference.cs
- ApplicationException.cs
- CanExecuteRoutedEventArgs.cs
- CapabilitiesState.cs
- IdentityModelStringsVersion1.cs
- JoinQueryOperator.cs
- KeyPullup.cs
- ServicesExceptionNotHandledEventArgs.cs
- UrlAuthorizationModule.cs
- SettingsSection.cs
- UserMapPath.cs
- Composition.cs
- Constants.cs
- Visual3D.cs
- LocationReferenceEnvironment.cs
- ConfigPathUtility.cs
- XmlTextReaderImpl.cs
- DataGridViewTopRowAccessibleObject.cs
- InputBuffer.cs
- ScriptDescriptor.cs
- CheckPair.cs
- odbcmetadatacolumnnames.cs
- XmlValidatingReader.cs
- basecomparevalidator.cs
- Style.cs
- WebBrowserHelper.cs
- ServiceActivationException.cs
- StateRuntime.cs
- Base64Stream.cs
- StorageEndPropertyMapping.cs
- EncoderParameters.cs
- UnionQueryOperator.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- SuppressMergeCheckAttribute.cs
- Math.cs
- XslCompiledTransform.cs
- xmlglyphRunInfo.cs
- SchemaContext.cs
- TransformProviderWrapper.cs
- safesecurityhelperavalon.cs
- Buffer.cs
- PropertyGridEditorPart.cs
- ImpersonationContext.cs
- TextPatternIdentifiers.cs
- Keyboard.cs
- WriterOutput.cs
- WindowsSlider.cs
- VectorCollectionValueSerializer.cs
- PropertyGeneratedEventArgs.cs
- ConstraintEnumerator.cs
- DocumentViewerBaseAutomationPeer.cs
- initElementDictionary.cs
- Graph.cs
- CustomDictionarySources.cs
- CalculatedColumn.cs
- ConsumerConnectionPoint.cs
- EncryptedType.cs
- CompositeDuplexElement.cs
- RectAnimationUsingKeyFrames.cs
- Activator.cs
- FormatterServicesNoSerializableCheck.cs
- CultureSpecificStringDictionary.cs
- RegisteredHiddenField.cs
- HeaderPanel.cs
- CLRBindingWorker.cs
- ISFClipboardData.cs
- BuildProvider.cs
- formatter.cs
- AsyncDataRequest.cs
- HttpsHostedTransportConfiguration.cs
- Condition.cs
- AllMembershipCondition.cs
- Conditional.cs
- RelationshipEndMember.cs
- FixUp.cs
- CompiledRegexRunnerFactory.cs
- AppDomainManager.cs
- StorageEndPropertyMapping.cs
- FlowPosition.cs
- UriScheme.cs
- WebPartDisplayModeCancelEventArgs.cs
- TickBar.cs
- SafeRightsManagementHandle.cs
- ResourceManager.cs
- KnownTypesProvider.cs
- Type.cs
- log.cs
- LocatorManager.cs
- SchemaLookupTable.cs