The Labs \ Source Viewer \ SSCLI \ System.Configuration \ SettingsProperty

  1. //------------------------------------------------------------------------------
  2. // <copyright file="SettingsProperty.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.Configuration
  16. {
  17.     using System.Collections;
  18.     using System.Collections.Specialized;
  19.     using System.Runtime.Serialization;
  20.     using System.Configuration.Provider;
  21.     using System.Globalization;
  22.     using System.IO;
  23.     using System.Runtime.Serialization.Formatters.Binary;
  24.     using System.Xml.Serialization;
  25.     using System.ComponentModel;
  26.    
  27.     ////////////////////////////////////////////////////////////
  28.     ////////////////////////////////////////////////////////////
  29.     ////////////////////////////////////////////////////////////
  30.     public class SettingsProperty
  31.     {
  32.        
  33.         public virtual string Name {
  34.             get { return _Name; }
  35.             set { _Name = value; }
  36.         }
  37.         public virtual bool IsReadOnly {
  38.             get { return _IsReadOnly; }
  39.             set { _IsReadOnly = value; }
  40.         }
  41.         public virtual object DefaultValue {
  42.             get { return _DefaultValue; }
  43.             set { _DefaultValue = value; }
  44.         }
  45.         public virtual Type PropertyType {
  46.             get { return _PropertyType; }
  47.             set { _PropertyType = value; }
  48.         }
  49.         public virtual SettingsSerializeAs SerializeAs {
  50.             get { return _SerializeAs; }
  51.             set { _SerializeAs = value; }
  52.         }
  53.         public virtual SettingsProvider Provider {
  54.             get { return _Provider; }
  55.             set { _Provider = value; }
  56.         }
  57.         public virtual SettingsAttributeDictionary Attributes {
  58.             get { return _Attributes; }
  59.         }
  60.         public bool ThrowOnErrorDeserializing {
  61.             get { return _ThrowOnErrorDeserializing; }
  62.             set { _ThrowOnErrorDeserializing = value; }
  63.         }
  64.         public bool ThrowOnErrorSerializing {
  65.             get { return _ThrowOnErrorSerializing; }
  66.             set { _ThrowOnErrorSerializing = value; }
  67.         }
  68.        
  69.         ////////////////////////////////////////////////////////////
  70.         ////////////////////////////////////////////////////////////
  71.         public SettingsProperty(string name)
  72.         {
  73.             _Name = name;
  74.             _Attributes = new SettingsAttributeDictionary();
  75.         }
  76.        
  77.         public SettingsProperty(string name, Type propertyType, SettingsProvider provider, bool isReadOnly, object defaultValue, SettingsSerializeAs serializeAs, SettingsAttributeDictionary attributes, bool throwOnErrorDeserializing, bool throwOnErrorSerializing)
  78.         {
  79.             _Name = name;
  80.             _PropertyType = propertyType;
  81.             _Provider = provider;
  82.             _IsReadOnly = isReadOnly;
  83.             _DefaultValue = defaultValue;
  84.             _SerializeAs = serializeAs;
  85.             _Attributes = attributes;
  86.             _ThrowOnErrorDeserializing = throwOnErrorDeserializing;
  87.             _ThrowOnErrorSerializing = throwOnErrorSerializing;
  88.         }
  89.        
  90.        
  91.         ////////////////////////////////////////////////////////////
  92.         ////////////////////////////////////////////////////////////
  93.         public SettingsProperty(SettingsProperty propertyToCopy)
  94.         {
  95.             _Name = propertyToCopy.Name;
  96.             _IsReadOnly = propertyToCopy.IsReadOnly;
  97.             _DefaultValue = propertyToCopy.DefaultValue;
  98.             _SerializeAs = propertyToCopy.SerializeAs;
  99.             _Provider = propertyToCopy.Provider;
  100.             _PropertyType = propertyToCopy.PropertyType;
  101.             _ThrowOnErrorDeserializing = propertyToCopy.ThrowOnErrorDeserializing;
  102.             _ThrowOnErrorSerializing = propertyToCopy.ThrowOnErrorSerializing;
  103.             _Attributes = new SettingsAttributeDictionary(propertyToCopy.Attributes);
  104.         }
  105.        
  106.         private string _Name;
  107.         private bool _IsReadOnly;
  108.         private object _DefaultValue;
  109.         private SettingsSerializeAs _SerializeAs;
  110.         private SettingsProvider _Provider;
  111.         private SettingsAttributeDictionary _Attributes;
  112.         private Type _PropertyType;
  113.         private bool _ThrowOnErrorDeserializing;
  114.         private bool _ThrowOnErrorSerializing;
  115.     }
  116. }

Developer Fusion