src/NetStandard/Core/Core/src/Utils/ObjectUtils.cs
/// <summary>
/// Gets the value of a Property for a given object instance.
/// </summary>
/// <typeparam name="ValueType">The <see cref="Type"/> you want the value to be converted to when returned.</typeparam>
/// <param name="instance">The Type instance to extract the Property's data from.</param>
/// <param name="propertyName">The name of the Property to extract the data from.</param>
/// <returns></returns>
Gets the value of a Property for a given object instance.
Gets the value of a Property for a given object instance .
[return: MaybeNull]
        internal static ValueType GetPropertyValue<ValueType>(object instance, string propertyName, BindingFlags flags = 0)
        {
            var pi = instance.GetType().GetProperty(propertyName, flags);
            return (ValueType)pi?.GetValue(instance, null);
        }
[ return : MaybeNull ] internal static ValueType GetPropertyValue < ValueType > ( object instance , string propertyName , BindingFlags flags = 0 ) { var pi = instance . GetType ( ) . GetProperty ( propertyName , flags ) ; return ( ValueType ) pi ? . GetValue ( instance , null ) ; }
Gets the value of a Property for a given object instance.
Gets the value of a Property for a given object instance .
None
instance
object
The Type instance to extract the Property's data from.
The Type instance to extract the Property ' s data from .
propertyName
string
The name of the Property to extract the data from.
The name of the Property to extract the data from .
flags
BindingFlags
typeparam
The  you want the value to be converted to when returned.
The you want the value to be converted to when returned .