DateTimeSerializationSection.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Xml / System / Xml / Serialization / Configuration / DateTimeSerializationSection.cs / 1 / DateTimeSerializationSection.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
//-----------------------------------------------------------------------------
 
namespace System.Xml.Serialization.Configuration 
{
    using System; 
    using System.Configuration;
    using System.ComponentModel;
    using System.Globalization;
    using System.Reflection; 

    public sealed class DateTimeSerializationSection : ConfigurationSection 
    { 
        public enum DateTimeSerializationMode
        { 
            Default = 0,
            Roundtrip = 1,
            Local = 2,
        } 

        public DateTimeSerializationSection() 
        { 
            this.properties.Add(this.mode);
        } 

        protected override ConfigurationPropertyCollection Properties
        {
            get 
            {
                return this.properties; 
            } 
        }
 
        [ConfigurationProperty(ConfigurationStrings.Mode, DefaultValue=DateTimeSerializationMode.Roundtrip)]
        public DateTimeSerializationMode Mode
        {
            get { return (DateTimeSerializationMode) this[this.mode]; } 
            set { this[this.mode] = value; }
        } 
 
        ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
 
        // Supply a type converter, even though it's a plain type converter, to get around ConfigurationProperty's internal
        // Enum conversion routine.  The internal one is case-sensitive, we want this to be case-insensitive.
        readonly ConfigurationProperty mode =
            new ConfigurationProperty(ConfigurationStrings.Mode, typeof(DateTimeSerializationMode), DateTimeSerializationMode.Roundtrip, 
                    new EnumConverter(typeof(DateTimeSerializationMode)), null, ConfigurationPropertyOptions.None);
 
    } 

} 


// 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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK