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
- SqlClientPermission.cs
- ThreadInterruptedException.cs
- ZipIOModeEnforcingStream.cs
- PopOutPanel.cs
- TagMapInfo.cs
- CompilerGeneratedAttribute.cs
- UniqueIdentifierService.cs
- cookiecollection.cs
- XmlIlVisitor.cs
- TextEffectResolver.cs
- Win32SafeHandles.cs
- DependencyStoreSurrogate.cs
- WindowsListViewItemStartMenu.cs
- SupportingTokenSecurityTokenResolver.cs
- WindowsFormsHelpers.cs
- DbConnectionPoolOptions.cs
- DesignerToolboxInfo.cs
- RectAnimation.cs
- XmlSchemaAnnotation.cs
- ValueSerializer.cs
- ByteStack.cs
- NativeMethods.cs
- Bold.cs
- ParameterModifier.cs
- FrameworkElementAutomationPeer.cs
- WorkflowPageSetupDialog.cs
- SynchronizedKeyedCollection.cs
- DataGridViewImageColumn.cs
- MyContact.cs
- TargetPerspective.cs
- SqlDataSourceView.cs
- InvalidPropValue.cs
- ConfigurationStrings.cs
- Point3D.cs
- BinaryNode.cs
- AudioStateChangedEventArgs.cs
- DataKeyArray.cs
- NativeMethods.cs
- Accessors.cs
- ExtenderProvidedPropertyAttribute.cs
- TransactionWaitAsyncResult.cs
- IndexedEnumerable.cs
- WindowsUpDown.cs
- ArglessEventHandlerProxy.cs
- ThicknessAnimationUsingKeyFrames.cs
- WebPartAddingEventArgs.cs
- HttpChannelBindingToken.cs
- ContextQuery.cs
- WMIInterop.cs
- Win32Interop.cs
- ActiveXSite.cs
- HashCodeCombiner.cs
- ReadOnlyCollectionBuilder.cs
- JsonReader.cs
- ConfigurationSectionGroup.cs
- FixedSOMTable.cs
- HttpResponseBase.cs
- ComponentCommands.cs
- SignatureResourceHelper.cs
- Pts.cs
- DynamicActivityXamlReader.cs
- WebBrowserEvent.cs
- FontWeight.cs
- ListSortDescriptionCollection.cs
- RuleElement.cs
- HandlerBase.cs
- RecognizerStateChangedEventArgs.cs
- EntityContainerEmitter.cs
- TemplatePropertyEntry.cs
- ProtectedConfigurationSection.cs
- SystemIPGlobalStatistics.cs
- TextWriterTraceListener.cs
- GPPOINT.cs
- EndEvent.cs
- WindowsButton.cs
- CodeTypeParameter.cs
- ThreadStaticAttribute.cs
- FloatAverageAggregationOperator.cs
- ProfileSettings.cs
- FilterableAttribute.cs
- documentsequencetextview.cs
- CommandSet.cs
- DropShadowBitmapEffect.cs
- StylusDevice.cs
- WebPartCollection.cs
- AccessibleObject.cs
- ConsumerConnectionPointCollection.cs
- ModelItemExtensions.cs
- DataShape.cs
- VectorCollectionConverter.cs
- ButtonStandardAdapter.cs
- RoutingService.cs
- WrappedIUnknown.cs
- CalendarBlackoutDatesCollection.cs
- figurelength.cs
- TraceHwndHost.cs
- IriParsingElement.cs
- ControlEvent.cs
- XDRSchema.cs
- LicenseProviderAttribute.cs