ApplicationSettings.Internal.PropertyHelper.CanWriteInto C# (CSharp) 메소드

CanWriteInto() 공개 정적인 메소드

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. ///
리턴 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;
        }