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

CanWriteInto() public static method

Checks if property can be written into. If the property is read only or it is ignored then we cannot write into it.
public static CanWriteInto ( PropertyInfo propertyInfo ) : bool
propertyInfo System.Reflection.PropertyInfo /// The property info. ///
return bool
        public static bool CanWriteInto(PropertyInfo propertyInfo)
        {
            if (!propertyInfo.CanWrite)
            {
                return false;
            }

            // if the property is located in this class then we don't write into 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.EnableWriting;
            }

            return true;
        }