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
- DbParameterHelper.cs
- AQNBuilder.cs
- While.cs
- categoryentry.cs
- ExpressionEditorAttribute.cs
- WebPartConnectionsConnectVerb.cs
- parserscommon.cs
- Content.cs
- PathTooLongException.cs
- WebPartVerb.cs
- Exceptions.cs
- CustomSignedXml.cs
- DataGridViewComboBoxEditingControl.cs
- NetworkAddressChange.cs
- DbModificationClause.cs
- SortedDictionary.cs
- EntityDataSourceContextCreatingEventArgs.cs
- NumericUpDownAccelerationCollection.cs
- Camera.cs
- SqlDataSourceCommandEventArgs.cs
- BitVec.cs
- EventToken.cs
- PreloadedPackages.cs
- TagNameToTypeMapper.cs
- AddInPipelineAttributes.cs
- MembershipValidatePasswordEventArgs.cs
- XsdValidatingReader.cs
- LZCodec.cs
- AppModelKnownContentFactory.cs
- TranslateTransform3D.cs
- RadioButtonBaseAdapter.cs
- OrderingInfo.cs
- ContextMenuAutomationPeer.cs
- BuildDependencySet.cs
- FunctionGenerator.cs
- ActivationServices.cs
- WebZone.cs
- UncommonField.cs
- Pts.cs
- ToolStripDropDownItem.cs
- __TransparentProxy.cs
- ListItemCollection.cs
- IncomingWebRequestContext.cs
- DocumentGridPage.cs
- FuncTypeConverter.cs
- RuleSettingsCollection.cs
- AssemblyCacheEntry.cs
- Int32Rect.cs
- Journal.cs
- ConnectionStringSettingsCollection.cs
- Normalizer.cs
- LinearGradientBrush.cs
- OutputWindow.cs
- RelatedCurrencyManager.cs
- MouseCaptureWithinProperty.cs
- EventLogPermissionAttribute.cs
- MultipartIdentifier.cs
- ResourceExpressionBuilder.cs
- ConfigurationManagerHelper.cs
- LinqMaximalSubtreeNominator.cs
- Pick.cs
- CodeAttributeArgumentCollection.cs
- ReflectionUtil.cs
- Persist.cs
- SecurityTokenParametersEnumerable.cs
- AutomationInteropProvider.cs
- HtmlUtf8RawTextWriter.cs
- ScriptResourceInfo.cs
- BindingManagerDataErrorEventArgs.cs
- CqlIdentifiers.cs
- ActivationArguments.cs
- DirectoryNotFoundException.cs
- XmlILOptimizerVisitor.cs
- TextSegment.cs
- Evidence.cs
- XmlExtensionFunction.cs
- TextInfo.cs
- Style.cs
- OLEDB_Enum.cs
- TextBlock.cs
- Quaternion.cs
- BindingNavigator.cs
- SqlUdtInfo.cs
- PreProcessInputEventArgs.cs
- QueryCursorEventArgs.cs
- XmlBaseReader.cs
- LinkConverter.cs
- PkcsMisc.cs
- LineSegment.cs
- RegistryPermission.cs
- HandlerBase.cs
- XmlProcessingInstruction.cs
- ThumbButtonInfoCollection.cs
- ToolStripPanelCell.cs
- ColumnClickEvent.cs
- SafeArrayTypeMismatchException.cs
- RuntimeConfigLKG.cs
- SocketException.cs
- BatchWriter.cs
- SqlSelectClauseBuilder.cs