NServiceBus.MemberInfoExtensions.GetValue C# (CSharp) Méthode

GetValue() public static méthode

public static GetValue ( this member, object source ) : object
member this
source object
Résultat object
        public static object GetValue(this MemberInfo member, object source)
        {
            var fieldInfo = member as FieldInfo;

            if (fieldInfo != null)
            {
                var field = DelegateFactory.CreateGet(fieldInfo);
                return field.Invoke(source);
            }

            var propertyInfo = (PropertyInfo) member;

            if (!propertyInfo.CanRead)
            {
                if (propertyInfo.PropertyType.IsValueType)
                {
                    return Activator.CreateInstance(propertyInfo.PropertyType);
                }

                return null;
            }

            var property = DelegateFactory.CreateGet(propertyInfo);
            return property.Invoke(source);
        }
MemberInfoExtensions