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
- HttpChannelHelper.cs
- NumberFunctions.cs
- WindowsIdentity.cs
- XmlReaderSettings.cs
- StorageComplexPropertyMapping.cs
- DesignerGeometryHelper.cs
- FastEncoderWindow.cs
- While.cs
- Visual3DCollection.cs
- AttachmentService.cs
- DllNotFoundException.cs
- DbParameterHelper.cs
- ListControlDesigner.cs
- JobInputBins.cs
- HttpCacheParams.cs
- ListControl.cs
- PrefixQName.cs
- BoolLiteral.cs
- SignatureToken.cs
- _RequestCacheProtocol.cs
- GridViewPageEventArgs.cs
- ConcurrentDictionary.cs
- WinFormsUtils.cs
- MetadataProperty.cs
- TokenBasedSet.cs
- TriggerBase.cs
- QueryActivatableWorkflowsCommand.cs
- ArrayHelper.cs
- FontDifferentiator.cs
- Point4DConverter.cs
- SendMailErrorEventArgs.cs
- ClientApiGenerator.cs
- SmiContext.cs
- KnownBoxes.cs
- Debug.cs
- SvcMapFileSerializer.cs
- ObjectConverter.cs
- CheckBoxField.cs
- DBNull.cs
- LocatorManager.cs
- Rethrow.cs
- TypeConstant.cs
- SQLDouble.cs
- ReceiveDesigner.xaml.cs
- OutputCacheProfileCollection.cs
- SymbolPair.cs
- RenderTargetBitmap.cs
- SpecularMaterial.cs
- DataSetMappper.cs
- ReflectTypeDescriptionProvider.cs
- EditingScopeUndoUnit.cs
- DataObjectEventArgs.cs
- ProviderSettingsCollection.cs
- ProcessManager.cs
- SoundPlayer.cs
- TextEditorParagraphs.cs
- RenderData.cs
- SuppressMergeCheckAttribute.cs
- DesignerActionKeyboardBehavior.cs
- ListInitExpression.cs
- DeclaredTypeValidatorAttribute.cs
- GlyphCollection.cs
- ControlIdConverter.cs
- DocumentPageViewAutomationPeer.cs
- Reference.cs
- ReceiveActivityValidator.cs
- XmlNotation.cs
- LinearGradientBrush.cs
- _CacheStreams.cs
- TextBoxRenderer.cs
- AssemblyResourceLoader.cs
- ApplicationFileParser.cs
- StandardCommandToolStripMenuItem.cs
- EmptyElement.cs
- SystemThemeKey.cs
- DataSourceControlBuilder.cs
- X509Utils.cs
- ContentType.cs
- Interop.cs
- RenderOptions.cs
- MemberListBinding.cs
- _DigestClient.cs
- DesignerHelpers.cs
- SqlProvider.cs
- ExpressionBuilder.cs
- EventMappingSettings.cs
- SafeFindHandle.cs
- SchemaNamespaceManager.cs
- GridViewColumn.cs
- EdmPropertyAttribute.cs
- FullTextLine.cs
- DataGridViewImageColumn.cs
- LocationReferenceValue.cs
- EncodingInfo.cs
- SingleAnimationUsingKeyFrames.cs
- DefaultProxySection.cs
- RedirectionProxy.cs
- XmlTextWriter.cs
- HttpInputStream.cs
- DoubleAnimation.cs