Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Base / MS / Internal / Markup / TypeConverterValueSerializer.cs / 1 / 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, CultureInfo.GetCultureInfo("en-us"), value); } public override bool CanConvertFromString(string value, IValueSerializerContext context) { return true; } public override object ConvertFromString(string value, IValueSerializerContext context) { return converter.ConvertFrom(context, CultureInfo.GetCultureInfo("en-us"), 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, CultureInfo.GetCultureInfo("en-us"), value); } public override bool CanConvertFromString(string value, IValueSerializerContext context) { return true; } public override object ConvertFromString(string value, IValueSerializerContext context) { return converter.ConvertFrom(context, CultureInfo.GetCultureInfo("en-us"), 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
- SynchronizedInputProviderWrapper.cs
- querybuilder.cs
- GeometryCollection.cs
- DeflateStream.cs
- WebPartDeleteVerb.cs
- ConfigXmlComment.cs
- DesignerActionTextItem.cs
- ViewBase.cs
- ZipIOLocalFileHeader.cs
- LinearGradientBrush.cs
- XamlSerializerUtil.cs
- ValidatorCollection.cs
- RuleRefElement.cs
- SqlClientPermission.cs
- EmptyStringExpandableObjectConverter.cs
- DeviceContexts.cs
- TrackingMemoryStreamFactory.cs
- RegexCompiler.cs
- StaticResourceExtension.cs
- LayoutTable.cs
- dbdatarecord.cs
- RelationshipEnd.cs
- Axis.cs
- DefaultAssemblyResolver.cs
- RegexCompilationInfo.cs
- EventWaitHandle.cs
- ObjectView.cs
- DataRelation.cs
- AssociationType.cs
- WaveHeader.cs
- DynamicRendererThreadManager.cs
- SqlOuterApplyReducer.cs
- AuthorizationPolicyTypeElement.cs
- _SslStream.cs
- DelimitedListTraceListener.cs
- UniqueEventHelper.cs
- DelegateHelpers.cs
- RegexFCD.cs
- Crypto.cs
- RowUpdatingEventArgs.cs
- ConfigurationStrings.cs
- UpdatePanel.cs
- HtmlElementEventArgs.cs
- LineServicesCallbacks.cs
- SmtpFailedRecipientsException.cs
- Visual3DCollection.cs
- ReferentialConstraint.cs
- AcceleratedTokenAuthenticator.cs
- SelectionHighlightInfo.cs
- SafeReversePInvokeHandle.cs
- OdbcHandle.cs
- UdpSocketReceiveManager.cs
- FirstQueryOperator.cs
- BitmapCacheBrush.cs
- GeneralTransform.cs
- AvTraceFormat.cs
- WebConfigurationFileMap.cs
- SortFieldComparer.cs
- SoapExtensionTypeElementCollection.cs
- GlyphsSerializer.cs
- DoubleStorage.cs
- URLMembershipCondition.cs
- Panel.cs
- Configuration.cs
- EntityConnectionStringBuilderItem.cs
- Typeface.cs
- XmlILOptimizerVisitor.cs
- ModelTreeManager.cs
- FixedFindEngine.cs
- TaskExtensions.cs
- InfocardInteractiveChannelInitializer.cs
- HierarchicalDataBoundControl.cs
- ByteAnimationUsingKeyFrames.cs
- mediaclock.cs
- StateInitialization.cs
- UrlAuthorizationModule.cs
- SharedPerformanceCounter.cs
- MenuItemStyle.cs
- SendOperation.cs
- BooleanFacetDescriptionElement.cs
- TemplatePagerField.cs
- CompiledAction.cs
- DbBuffer.cs
- OptimalBreakSession.cs
- AccessDataSourceDesigner.cs
- FactoryRecord.cs
- TypedServiceOperationListItem.cs
- RenderDataDrawingContext.cs
- GridPatternIdentifiers.cs
- ResourceBinder.cs
- SafeNativeMethods.cs
- WaitForChangedResult.cs
- _NegoStream.cs
- SqlReferenceCollection.cs
- AdornerPresentationContext.cs
- MouseDevice.cs
- XmlWrappingReader.cs
- DefaultValueConverter.cs
- EntityDataSourceChangingEventArgs.cs
- WindowsListBox.cs