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
- InvalidOperationException.cs
- CloseCryptoHandleRequest.cs
- RepeaterItemCollection.cs
- GridItem.cs
- AdapterUtil.cs
- VirtualPath.cs
- ToolStripSplitButton.cs
- BufferedGraphicsManager.cs
- TextCollapsingProperties.cs
- PointCollection.cs
- ProxySimple.cs
- BaseEntityWrapper.cs
- Exceptions.cs
- DeviceContext.cs
- DrawingBrush.cs
- errorpatternmatcher.cs
- DictionaryEditChange.cs
- CheckoutException.cs
- HighlightVisual.cs
- RTLAwareMessageBox.cs
- DesignerObject.cs
- RichTextBox.cs
- XmlElementList.cs
- TraceUtils.cs
- QuestionEventArgs.cs
- RubberbandSelector.cs
- figurelengthconverter.cs
- LayoutEditorPart.cs
- LexicalChunk.cs
- documentsequencetextcontainer.cs
- MaterialGroup.cs
- ACE.cs
- SpStreamWrapper.cs
- SparseMemoryStream.cs
- SchemaObjectWriter.cs
- DBSchemaRow.cs
- EncodingTable.cs
- PackageDigitalSignatureManager.cs
- FactoryId.cs
- VisemeEventArgs.cs
- HierarchicalDataBoundControl.cs
- OrderedHashRepartitionEnumerator.cs
- Pipe.cs
- ToggleProviderWrapper.cs
- ResourceManagerWrapper.cs
- WebPartConnection.cs
- Constraint.cs
- SubclassTypeValidator.cs
- OptimisticConcurrencyException.cs
- MutexSecurity.cs
- ModulesEntry.cs
- PropertyManager.cs
- ModelChangedEventArgsImpl.cs
- XmlSchemaCompilationSettings.cs
- ToolStripDropDownClosedEventArgs.cs
- ECDsaCng.cs
- PackagingUtilities.cs
- SHA384.cs
- MenuBase.cs
- PerformanceCountersElement.cs
- DocumentGridPage.cs
- Utils.cs
- ObjectToken.cs
- FrugalMap.cs
- TextDecorationCollection.cs
- XPathParser.cs
- DeobfuscatingStream.cs
- StringFreezingAttribute.cs
- UrlAuthFailedErrorFormatter.cs
- OleDbParameter.cs
- SyndicationSerializer.cs
- WebPartEditorApplyVerb.cs
- SubMenuStyle.cs
- ImpersonationContext.cs
- DefaultAssemblyResolver.cs
- ProgressiveCrcCalculatingStream.cs
- XmlDataLoader.cs
- DataServiceContext.cs
- JpegBitmapDecoder.cs
- WpfKnownType.cs
- M3DUtil.cs
- BaseUriHelper.cs
- Itemizer.cs
- Add.cs
- WmlLinkAdapter.cs
- ObjectDataSourceSelectingEventArgs.cs
- MsmqIntegrationOutputChannel.cs
- TemplateBamlTreeBuilder.cs
- ExpressionParser.cs
- GeometryDrawing.cs
- IpcChannelHelper.cs
- SymbolEqualComparer.cs
- LabelAutomationPeer.cs
- MenuItem.cs
- ParsedAttributeCollection.cs
- DockProviderWrapper.cs
- PrivilegeNotHeldException.cs
- DeclarationUpdate.cs
- XPathQueryGenerator.cs
- ListControl.cs