Exemple #1
0
            /// <summary>
            /// Sets the <see cref="value"/> to the <see cref="fullPropertyName"/>
            /// </summary>
            /// <param name="destination">Object which contains the property with <see cref="fullPropertyName"/></param>
            /// <param name="fullPropertyName"> name of the property to be changed</param>
            /// <param name="value">Value of the property to be setted</param>
            public static void SetValue(object destination, string fullPropertyName, object value)
            {
                object valueToSet = value == DBNull.Value ? null : value;

                PropertyInfoAndObj propertyInfoAndObj =
                    GetPropertyPropertyInfoAndObjForFinalProperty(destination, fullPropertyName);

                propertyInfoAndObj.PropertyInfo.SetValue(propertyInfoAndObj.OwnerOfProperty, valueToSet, null);
            }
Exemple #2
0
        public static object GetValue(string fullPropertyName, object source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source", "Parameter 'source' must be different from null");
            }

            PropertyInfoAndObj propertyInfoAndObj =
                GetPropertyPropertyInfoAndObjForFinalProperty(source, fullPropertyName);

            return(propertyInfoAndObj.PropertyInfo.GetValue(propertyInfoAndObj.OwnerOfProperty, null));
        }