Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Base / MS / Internal / Markup / TypeConverterValueSerializer.cs / 1 / TypeConverterValueSerializer.cs
//------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2005 // // File: TypeConverterValueSerializer.cs // // Contents: TypeConverter to ValueSerializer adapter // // Created: 04/28/2005 chuckj // //----------------------------------------------------------------------- using System.ComponentModel; using System.Globalization; using System.Windows.Markup; namespace MS.Internal.Serialization { ////// The TypeConverter value serializer uses a TypeConverter to implement the translation /// to and from a string. The caller of the constructor must ensure the TypeConverter supports /// converstion to and from string. /// internal sealed class TypeConverterValueSerializer : ValueSerializer { private TypeConverter converter; public TypeConverterValueSerializer(TypeConverter converter) { this.converter = converter; } public override bool CanConvertToString(object value, IValueSerializerContext context) { return converter.CanConvertTo(context, typeof(string)); } public override string ConvertToString(object value, IValueSerializerContext context) { return converter.ConvertToString(context, CultureInfo.GetCultureInfo("en-us"), value); } public override bool CanConvertFromString(string value, IValueSerializerContext context) { return true; } public override object ConvertFromString(string value, IValueSerializerContext context) { return converter.ConvertFrom(context, CultureInfo.GetCultureInfo("en-us"), value); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SqlRetyper.cs
- _DomainName.cs
- ObjectAnimationUsingKeyFrames.cs
- DrawListViewColumnHeaderEventArgs.cs
- Comparer.cs
- KeyConverter.cs
- Parameter.cs
- ProviderSettingsCollection.cs
- InvalidProgramException.cs
- CapabilitiesPattern.cs
- COM2EnumConverter.cs
- GridPattern.cs
- ToolStripContentPanelRenderEventArgs.cs
- ScrollProperties.cs
- FaultImportOptions.cs
- ContourSegment.cs
- DbParameterHelper.cs
- datacache.cs
- DataSourceConverter.cs
- WindowsPrincipal.cs
- ModelUtilities.cs
- StateBag.cs
- AuthenticationConfig.cs
- TextEditorParagraphs.cs
- ConfigDefinitionUpdates.cs
- uribuilder.cs
- DataRecordInternal.cs
- DefaultSection.cs
- EventListener.cs
- DataProtectionSecurityStateEncoder.cs
- ServicesExceptionNotHandledEventArgs.cs
- WsdlParser.cs
- DataGridViewSelectedCellCollection.cs
- SamlSerializer.cs
- MenuItemBinding.cs
- ExclusiveTcpTransportManager.cs
- SafeLibraryHandle.cs
- ScrollItemPatternIdentifiers.cs
- HostingEnvironmentSection.cs
- DesignerTransaction.cs
- FacetDescriptionElement.cs
- GroupLabel.cs
- ErasingStroke.cs
- ConstructorBuilder.cs
- ProbeMatches11.cs
- WebServiceTypeData.cs
- AdRotator.cs
- StrongNameHelpers.cs
- BatchServiceHost.cs
- XmlArrayAttribute.cs
- RegistryExceptionHelper.cs
- OutOfProcStateClientManager.cs
- TextReader.cs
- XPathMessageFilterElementCollection.cs
- FunctionNode.cs
- DataGridItem.cs
- DataGridTextBox.cs
- XmlNamespaceManager.cs
- XomlCompiler.cs
- WindowsScroll.cs
- MarshalDirectiveException.cs
- DataGridView.cs
- UpdateTranslator.cs
- CorrelationScope.cs
- ConstantProjectedSlot.cs
- AnnotationComponentManager.cs
- OraclePermission.cs
- DrawingContextWalker.cs
- SR.cs
- ConnectAlgorithms.cs
- SurrogateEncoder.cs
- SafeLibraryHandle.cs
- OneOfTypeConst.cs
- PixelShader.cs
- XmlAnyAttributeAttribute.cs
- MultiSelectRootGridEntry.cs
- StyleXamlParser.cs
- MethodExecutor.cs
- PackageRelationship.cs
- ScopelessEnumAttribute.cs
- milrender.cs
- webeventbuffer.cs
- Figure.cs
- Pool.cs
- FormView.cs
- TreeNode.cs
- Variable.cs
- DesignerVerbCollection.cs
- SQLInt32Storage.cs
- SpecularMaterial.cs
- NetDataContractSerializer.cs
- CodeAccessPermission.cs
- GlobalizationSection.cs
- RootBrowserWindowAutomationPeer.cs
- Assembly.cs
- ISessionStateStore.cs
- EdmPropertyAttribute.cs
- ConsoleCancelEventArgs.cs
- LinearGradientBrush.cs
- InfoCardServiceInstallComponent.cs