Server.Commands.Properties.GetPropertyInfo C# (CSharp) Méthode

GetPropertyInfo() public static méthode

public static GetPropertyInfo ( Mobile from, object &obj, string propertyName, PropertyAccess access, string &failReason ) : PropertyInfo
from Mobile
obj object
propertyName string
access PropertyAccess
failReason string
Résultat System.Reflection.PropertyInfo
		public static PropertyInfo GetPropertyInfo( Mobile from, ref object obj, string propertyName, PropertyAccess access, ref string failReason )
		{
			PropertyInfo[] chain = GetPropertyInfoChain( from, obj.GetType(), propertyName, access, ref failReason );

			if ( chain == null )
				return null;

			return GetPropertyInfo( ref obj, chain, ref failReason );
		}

Same methods

Properties::GetPropertyInfo ( object &obj, PropertyInfo chain, string &failReason ) : PropertyInfo

Usage Example

        public bool CheckCondition(object obj)
        {
            bool ret;

            string       failReason = null;
            PropertyInfo endProp    = Properties.GetPropertyInfo(ref obj, m_PropertyInfoChain, ref failReason);

            if (endProp == null)
            {
                return(false);
            }

            object current = endProp.GetValue(obj, null);

            switch (m_Operator)
            {
            case ConditionOperator.Equality:
                ret = Equality(current); break;

            case ConditionOperator.Inequality:
                ret = !Equality(current); break;

            case ConditionOperator.Greater:
                ret = (CompareWith(current) > 0); break;

            case ConditionOperator.GreaterEqual:
                ret = (CompareWith(current) >= 0); break;

            case ConditionOperator.Lesser:
                ret = (CompareWith(current) < 0); break;

            case ConditionOperator.LesserEqual:
                ret = (CompareWith(current) <= 0); break;

            case ConditionOperator.EqualityInsensitive:
                ret = (Insensitive.Equals(AsString(current), AsString(m_Argument))); break;

            case ConditionOperator.InequalityInsensitive:
                ret = (!Insensitive.Equals(AsString(current), AsString(m_Argument))); break;

            case ConditionOperator.StartsWith:
                ret = (AsString(current).StartsWith(AsString(m_Argument))); break;

            case ConditionOperator.StartsWithInsensitive:
                ret = (Insensitive.StartsWith(AsString(current), AsString(m_Argument))); break;

            case ConditionOperator.EndsWith:
                ret = (AsString(current).EndsWith(AsString(m_Argument))); break;

            case ConditionOperator.EndsWithInsensitive:
                ret = (Insensitive.EndsWith(AsString(current), AsString(m_Argument))); break;

            case ConditionOperator.Contains:
                ret = (AsString(current).IndexOf(AsString(m_Argument)) >= 0); break;

            case ConditionOperator.ContainsInsensitive:
                ret = (Insensitive.Contains(AsString(current), AsString(m_Argument))); break;

            default: return(false);
            }

            if (m_LogicalNot)
            {
                ret = !ret;
            }

            return(ret);
        }
All Usage Examples Of Server.Commands.Properties::GetPropertyInfo