Core/CafeLib.Core.Dynamic/Expando.cs
/// <summary>
/// Reflection Helper method to retrieve a property
/// </summary>
/// <param name="instance"></param>
/// <param name="name"></param>
/// <param name="result"></param>
/// <returns></returns>
Reflection Helper method to retrieve a property
Reflection Helper method to retrieve a property
protected bool GetProperty(object instance, string name, out object result)
        {
            result = null;
            instance ??= this;
            var miArray = _instanceType.GetMember(name, BindingFlags.Public | BindingFlags.GetProperty | BindingFlags.Instance);
            if (miArray.Length > 0)
            {
                var mi = miArray[0];
                if (mi.MemberType == MemberTypes.Property)
                {
                    result = ((PropertyInfo)mi).GetValue(instance, null);
                    return true;
                }
            }
            return false;
        }
protected bool GetProperty ( object instance , string name , out object result ) { result = null ; instance ??= this ; var miArray = _instanceType . GetMember ( name , BindingFlags . Public | BindingFlags . GetProperty | BindingFlags . Instance ) ; if ( miArray . Length > 0 ) { var mi = miArray [ 0 ] ; if ( mi . MemberType == MemberTypes . Property ) { result = ( ( PropertyInfo ) mi ) . GetValue ( instance , null ) ; return true ; } } return false ; }
Reflection Helper method to retrieve a property
Reflection Helper method to retrieve a property
None
instance
object
None
name
string
None
object
out
result
None