Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SecondaryViewProvider.cs
- HttpListenerResponse.cs
- GradientStop.cs
- XmlILTrace.cs
- RegionIterator.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- BrowsableAttribute.cs
- Trigger.cs
- StreamUpdate.cs
- PriorityBinding.cs
- Stroke2.cs
- OutputCacheSection.cs
- GradientStop.cs
- MsdtcWrapper.cs
- MDIControlStrip.cs
- VariableExpressionConverter.cs
- TransformerInfo.cs
- IriParsingElement.cs
- IntegerValidator.cs
- CodeDomSerializerException.cs
- MarkupCompiler.cs
- ClientApiGenerator.cs
- CodeStatementCollection.cs
- Regex.cs
- PopupRootAutomationPeer.cs
- HandledEventArgs.cs
- ShaperBuffers.cs
- _AuthenticationState.cs
- StreamGeometry.cs
- ObjectParameter.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- WebPartCatalogAddVerb.cs
- HttpCacheVaryByContentEncodings.cs
- KeyPullup.cs
- PropertyPathWorker.cs
- ConfigXmlElement.cs
- JournalEntry.cs
- BaseTypeViewSchema.cs
- WebPartDisplayModeEventArgs.cs
- BevelBitmapEffect.cs
- Tool.cs
- IPAddress.cs
- DataTemplate.cs
- InitializerFacet.cs
- ScrollBarAutomationPeer.cs
- ThreadPool.cs
- CurrencyWrapper.cs
- RemoteEndpointMessageProperty.cs
- WrappedReader.cs
- keycontainerpermission.cs
- ConversionContext.cs
- X509UI.cs
- X509Certificate.cs
- DockPatternIdentifiers.cs
- DataObjectFieldAttribute.cs
- SynchronizedInputHelper.cs
- CustomAttributeFormatException.cs
- InOutArgumentConverter.cs
- DtrList.cs
- SessionConnectionReader.cs
- QilFactory.cs
- AbstractDataSvcMapFileLoader.cs
- PermissionSetTriple.cs
- WpfKnownMemberInvoker.cs
- CodeExpressionCollection.cs
- GatewayDefinition.cs
- BamlTreeNode.cs
- Int32Converter.cs
- XmlConverter.cs
- XPathNode.cs
- DataGridViewSelectedColumnCollection.cs
- EditBehavior.cs
- BindingCollection.cs
- SecureUICommand.cs
- MarginCollapsingState.cs
- SharedDp.cs
- Switch.cs
- LinqDataSourceEditData.cs
- UnsafeNetInfoNativeMethods.cs
- XmlTextWriter.cs
- OdbcEnvironmentHandle.cs
- FixUp.cs
- Timer.cs
- Restrictions.cs
- CodeExpressionCollection.cs
- VisualProxy.cs
- SqlTopReducer.cs
- SqlDataSource.cs
- HttpServerVarsCollection.cs
- UserControlParser.cs
- GridView.cs
- EntityConnectionStringBuilderItem.cs
- RuleAttributes.cs
- Compiler.cs
- TraceRecord.cs
- OLEDB_Util.cs
- CoTaskMemHandle.cs
- Model3D.cs
- ProcessProtocolHandler.cs
- WsatConfiguration.cs