Core/CafeLib.Core.Dynamic/Expando.cs
/// <summary>
/// Reflection helper method to set a property value
/// </summary>
/// <param name="name"></param>
/// <param name="value"></param>
/// <returns></returns>
Reflection helper method to set a property value
Reflection helper method to set a property value
protected bool SetProperty(string name, object value)
        {
            var miArray = _instanceType.GetMember(name, BindingFlags.Public | BindingFlags.SetProperty | BindingFlags.Instance);
            if (miArray.Length > 0)
            {
                var mi = miArray[0];
                if (mi.MemberType == MemberTypes.Property)
                {
                    ((PropertyInfo)mi).SetValue(_instance, value, null);
                    return true;
                }
            }
            return false;
        }
protected bool SetProperty ( string name , object value ) { var miArray = _instanceType . GetMember ( name , BindingFlags . Public | BindingFlags . SetProperty | BindingFlags . Instance ) ; if ( miArray . Length > 0 ) { var mi = miArray [ 0 ] ; if ( mi . MemberType == MemberTypes . Property ) { ( ( PropertyInfo ) mi ) . SetValue ( _instance , value , null ) ; return true ; } } return false ; }
Reflection helper method to set a property value
Reflection helper method to set a property value
None
name
string
None
value
object
None