ApplicationSettings.Internal.PropertyHelper.CanReadFrom C# (CSharp) Method

CanReadFrom() public static method

public static CanReadFrom ( PropertyInfo propertyInfo ) : bool
propertyInfo System.Reflection.PropertyInfo
return bool
        public static bool CanReadFrom(PropertyInfo propertyInfo)
        {
            if (!propertyInfo.CanRead)
            {
                return false;
            }

            // if the property is located in this class then we don't read from it.
            if (typeof(AppSettings) == propertyInfo.DeclaringType)
            {
                return false;
            }

            // If the property is ignored then we don't write into it.
            var ignoredAttribute = propertyInfo.GetCustomAttribute<IgnorePropertyAttribute>();
            if (null != ignoredAttribute)
            {
                return ignoredAttribute.EnableReading;
            }

            return true;
        }