Exemplo n.º 1
0
        /// <summary>
        /// Creates a new strongly typed scalar data which can be used as data binding source, from exising property or field .
        /// </summary>
        /// <typeparam name="T">The type of the scalar data.</typeparam>
        /// <param name="propertyOrFieldName">The name of the property or field.</param>
        /// <param name="equalityComparer">The equality comparer.</param>
        /// <returns>A new strongly typed scalar data which can be used as data binding source, from exising property or field.</returns>
        protected Scalar <T> NewLinkedScalar <T>(string propertyOrFieldName, IEqualityComparer <T> equalityComparer = null)
        {
            var getter = this.GetPropertyOrFieldGetter <T>(propertyOrFieldName);
            var setter = this.GetPropertyOrFieldSetter <T>(propertyOrFieldName);

            return(ScalarContainer.CreateNew(getter, setter, equalityComparer));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new strongly typed scalar data which can be used as data binding source, from existing getter and setter.
 /// </summary>
 /// <typeparam name="T">The type of the scalar data.</typeparam>
 /// <param name="getter">The exising getter of the scalar data.</param>
 /// <param name="setter">The existing setter of the scalar data.</param>
 /// <param name="equalityComparer">The equality comparer.</param>
 /// <returns>A new strongly typed scalar data which can be used as data binding source, from exising getter and setter.</returns>
 protected Scalar <T> NewLinkedScalar <T>(Func <T> getter, Action <T> setter, IEqualityComparer <T> equalityComparer = null)
 {
     getter.VerifyNotNull(nameof(getter));
     setter.VerifyNotNull(nameof(setter));
     return(ScalarContainer.CreateNew(getter, setter, equalityComparer));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a new strongly typed scalar data which can be used as data binding source.
 /// </summary>
 /// <typeparam name="T">The type of the scalar data.</typeparam>
 /// <param name="value">The initial value of the scalar data.</param>
 /// <param name="equalityComparer">The equality comparer.</param>
 /// <returns>A new strongly typed scalar data which can be used as data binding source.</returns>
 protected Scalar <T> NewScalar <T>(T value = default(T), IEqualityComparer <T> equalityComparer = null)
 {
     return(ScalarContainer.CreateNew(value, equalityComparer));
 }