示例#1
0
        internal static bool GreaterOrEquals(SelectorContext context, SelectorInfo info, object[] args, object o)
        {
            var properties = GetProperties(args);

            if (TryPropertyLong(properties, GREATEROREQUALS, out long?propertyValue) && TryField(properties, out string field))
            {
                context.Debug(PSDocsResources.SelectorExpressionTrace, GREATEROREQUALS, field, propertyValue);
                if (!ObjectHelper.GetField(context, o, field, caseSensitive: false, out object value))
                {
                    return(true);
                }

                if (value == null)
                {
                    return(0 >= propertyValue);
                }

                if (ExpressionHelpers.CompareNumeric(value, propertyValue, convert: false, compare: out int compare, value: out _))
                {
                    return(compare >= 0);
                }
            }
            return(false);
        }