using System;
using System.Collections.Generic;
namespace Chernobyl.Values
{
///
/// A type that acts as a basic implementation of .
/// This type can be used on its own to offer notifications of changes to
/// the value held by the type or make the creation of new
/// types easier.
///
/// The type being held within this instance.
public class DynamicContainer : BasicContainer, IDynamicContainer
{
///
/// Initializes a new instance of the class
/// that uses the default value of for
/// and
/// for the
/// property.
///
public DynamicContainer() : this(default(T))
{}
///
/// Initializes a new instance of the class
/// that uses
/// for the
/// property.
///
/// The value held by this instance.
public DynamicContainer(T value)
: this(value, EqualityComparer.Default)
{}
///
/// Initializes a new instance of the class.
///
/// The value held by this instance.
/// The instance used to compare new and previous
/// values of to determine if
/// should be raised.
/// Thrown if
/// is null.
public DynamicContainer(T value, IEqualityComparer comparer)
: base(value, comparer)
{}
///
/// The value held by this instance. If the value has not yet been
/// provided it will be equal to default(T).
///
public new T Value
{
get { return base.Value; }
set { base.Value = value; }
}
///
/// The instance used to compare new and previous values of
/// to determine if
/// should be raised.
///
/// Thrown if the value set on
/// this property is null.
public new IEqualityComparer Comparer
{
get { return base.Comparer; }
set { base.Comparer = value; }
}
}
}