using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using JD.Collections;
using JD.Collections.Extensions;
using JD.Kernel.Classes;
using JD.Kernel.Interfaces;
using JD.Kernel.StaticHelpers;
using JD.Reflection;
using JD.Serializers.Xml;
namespace JD.PropertyService
{
///
/// A collection of properties and sub-properties.
///
[Serializable]
public class Properties : IProperties, ICloneable
{
#region Constants
private const string PropertiesElement = "Properties";
private const string PropertyName = "Property";
private const string NameAttribute = "name";
private const string ValueAttribute = "value";
private const string TypeAttribute = "type";
#endregion
#region Variables
private readonly PropertyCollection m_properties = new PropertyCollection();
private readonly IProperties m_parent;
private int m_isUpdatingCount;
private readonly TypeConverterCache _typeConverter = new TypeConverterCache();
#endregion
#region Constructor
///
/// Default creation constructor.
///
public Properties()
: this(null, null)
{
}
private Properties(Properties other, IProperties parent)
{
m_parent = parent;
if (other != null)
{
other.CopyTo(this);
}
}
#endregion
#region Properties
public bool IsUpdating
{
get { return m_isUpdatingCount > 0; }
}
///
/// Whether these properties are read-only.
///
public virtual bool IsReadOnly
{
get { return false; }
}
///
/// Number of values.
///
public int Count
{
get
{
return m_properties.Count;
}
}
public IEnumerable Keys
{
get { return m_properties.Select(v => v.Key); }
}
public IEnumerable