Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Base / MS / Internal / Markup / TypeConverterValueSerializer.cs / 2 / TypeConverterValueSerializer.cs
//------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2005 // // File: TypeConverterValueSerializer.cs // // Contents: TypeConverter to ValueSerializer adapter // // Created: 04/28/2005 [....] // //----------------------------------------------------------------------- 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, System.Windows.Markup.TypeConverterHelper.EnglishUSCulture, value); } public override bool CanConvertFromString(string value, IValueSerializerContext context) { return true; } public override object ConvertFromString(string value, IValueSerializerContext context) { return converter.ConvertFrom(context, System.Windows.Markup.TypeConverterHelper.EnglishUSCulture, value); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2005 // // File: TypeConverterValueSerializer.cs // // Contents: TypeConverter to ValueSerializer adapter // // Created: 04/28/2005 [....] // //----------------------------------------------------------------------- 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, System.Windows.Markup.TypeConverterHelper.EnglishUSCulture, value); } public override bool CanConvertFromString(string value, IValueSerializerContext context) { return true; } public override object ConvertFromString(string value, IValueSerializerContext context) { return converter.ConvertFrom(context, System.Windows.Markup.TypeConverterHelper.EnglishUSCulture, 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
- SecurityManager.cs
- SqlDeflator.cs
- TraceUtils.cs
- BooleanFunctions.cs
- ActiveXHelper.cs
- ISessionStateStore.cs
- AggregateNode.cs
- TextSchema.cs
- ValueExpressions.cs
- ScaleTransform.cs
- DesignerMetadata.cs
- ZoomComboBox.cs
- DrawingGroupDrawingContext.cs
- DataServiceHost.cs
- TableLayoutPanelCodeDomSerializer.cs
- DataServiceHostFactory.cs
- ReceiveReply.cs
- DynamicEndpointElement.cs
- BinaryWriter.cs
- MissingSatelliteAssemblyException.cs
- ClientApiGenerator.cs
- TypedDataSetSchemaImporterExtension.cs
- UpWmlPageAdapter.cs
- TemplateColumn.cs
- BulletChrome.cs
- MainMenu.cs
- XmlnsDictionary.cs
- DataBoundLiteralControl.cs
- SqlRetyper.cs
- AdRotator.cs
- OdbcReferenceCollection.cs
- UrlMappingsModule.cs
- HttpModuleActionCollection.cs
- InlinedLocationReference.cs
- SlotInfo.cs
- LinkLabelLinkClickedEvent.cs
- TransformerInfo.cs
- Vector3DConverter.cs
- AdornerHitTestResult.cs
- ProfileParameter.cs
- SizeFConverter.cs
- NamedPermissionSet.cs
- HandoffBehavior.cs
- ArrayConverter.cs
- XmlSerializationGeneratedCode.cs
- InstallerTypeAttribute.cs
- RegisteredScript.cs
- DocumentPageHost.cs
- Substitution.cs
- ChangeToolStripParentVerb.cs
- RequiredAttributeAttribute.cs
- ExpressionBindings.cs
- CommandLibraryHelper.cs
- InkPresenter.cs
- WizardStepBase.cs
- XmlQualifiedNameTest.cs
- Model3DGroup.cs
- RegisteredDisposeScript.cs
- GlobalItem.cs
- MembershipPasswordException.cs
- embossbitmapeffect.cs
- EndpointDiscoveryElement.cs
- SolidColorBrush.cs
- CatchDesigner.xaml.cs
- SafeEventLogReadHandle.cs
- WebSysDisplayNameAttribute.cs
- ScriptingRoleServiceSection.cs
- ConfigXmlDocument.cs
- InkCanvasSelection.cs
- InkCanvasInnerCanvas.cs
- MessageRpc.cs
- ComplusEndpointConfigContainer.cs
- TransformerTypeCollection.cs
- TrackPointCollection.cs
- RequestQueue.cs
- DocumentReferenceCollection.cs
- CompilerScopeManager.cs
- SmiEventSink_Default.cs
- DataGridViewColumnEventArgs.cs
- XmlSchemaIdentityConstraint.cs
- LookupNode.cs
- ChannelDemuxer.cs
- OletxEnlistment.cs
- UntrustedRecipientException.cs
- ElementProxy.cs
- DuplicateWaitObjectException.cs
- XmlDataSourceDesigner.cs
- TargetFrameworkAttribute.cs
- TableCellAutomationPeer.cs
- AuthenticationModulesSection.cs
- SelectedGridItemChangedEvent.cs
- Knowncolors.cs
- SoapServerMethod.cs
- CalloutQueueItem.cs
- PageVisual.cs
- DesignTimeXamlWriter.cs
- AnnotationHelper.cs
- RelatedView.cs
- UriTemplateMatch.cs
- SoapFault.cs