当前位置: 首页>>代码示例>>C#>>正文


C# ComparisonType类代码示例

本文整理汇总了C#中ComparisonType的典型用法代码示例。如果您正苦于以下问题:C# ComparisonType类的具体用法?C# ComparisonType怎么用?C# ComparisonType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ComparisonType类属于命名空间,在下文中一共展示了ComparisonType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: comparisonTypeToString

 private string comparisonTypeToString(ComparisonType type)
 {
     string result = "";
     switch (type) {
     case ComparisonType.E: {
         result = "=";
         break;
     }
     case ComparisonType.NE: {
         result = "!=";
         break;
     }
     case ComparisonType.GT: {
         result = ">";
         break;
     }
     case ComparisonType.GTE: {
         result = ">=";
         break;
     }
     case ComparisonType.LS: {
         result = "<";
         break;
     }
     case ComparisonType.LSE: {
         result = "<=";
         break;
     }
     }
     return result;
 }
开发者ID:Edhendil,项目名称:MonoLiteOrm,代码行数:31,代码来源:ComparisonCondition.cs

示例2: FilterOptions

 public FilterOptions(string col, ComparisonType type, string val)
     : this()
 {
     Col = col;
     Val = val;
     Type = type;
 }
开发者ID:arkanoid1,项目名称:mywowtools,代码行数:7,代码来源:FilterOptions.cs

示例3: WhereItem

 public WhereItem(string field, object value, ComparisonType comparisonType=ComparisonType.Equal,bool parameterize=true)
 {
     Field = field;
     ComparisonType = comparisonType;
     Value = value;
     Parameterize = parameterize;
 }
开发者ID:saneman1,项目名称:IQMap,代码行数:7,代码来源:WhereItem.cs

示例4: CompareTo

        /// <summary>
        /// Compares to the given value returning true if comparable.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <param name="compareValue">The compare value.</param>
        /// <param name="compareType">Type of the compare.</param>
        /// <returns></returns>
        public static bool CompareTo( this string value, string compareValue, ComparisonType compareType )
        {
            // Evaluate compare types that are not type specific
            switch ( compareType )
            {
                case ComparisonType.Contains: return value.Contains( compareValue );
                case ComparisonType.DoesNotContain: return !value.Contains( compareValue );
                case ComparisonType.StartsWith: return value.StartsWith( compareValue, StringComparison.OrdinalIgnoreCase );
                case ComparisonType.EndsWith: return value.EndsWith( compareValue, StringComparison.OrdinalIgnoreCase );
                case ComparisonType.IsBlank: return string.IsNullOrWhiteSpace( value );
                case ComparisonType.IsNotBlank: return !string.IsNullOrWhiteSpace( value );
                case ComparisonType.RegularExpression: return Regex.IsMatch( value, compareValue );
            }

            // numeric compares
            decimal? decimalValue = value.AsDecimalOrNull();
            decimal? decimalCompareValue = compareValue.AsDecimalOrNull();
            if ( decimalValue.HasValue && decimalCompareValue.HasValue )
            {
                switch ( compareType )
                {
                    case ComparisonType.EqualTo: return decimalValue == decimalCompareValue;
                    case ComparisonType.GreaterThan: return decimalValue.Value > decimalCompareValue.Value;
                    case ComparisonType.GreaterThanOrEqualTo: return decimalValue.Value >= decimalCompareValue.Value;
                    case ComparisonType.LessThan: return decimalValue.Value < decimalCompareValue.Value;
                    case ComparisonType.LessThanOrEqualTo: return decimalValue.Value <= decimalCompareValue.Value;
                    case ComparisonType.NotEqualTo: return decimalValue.Value != decimalCompareValue.Value;
                }
            }

            // date time compares
            DateTime? datetimeValue = value.AsDateTime();
            DateTime? datetimeCompareValue = compareValue.AsDateTime();
            if ( datetimeValue.HasValue && datetimeCompareValue.HasValue )
            {
                switch ( compareType )
                {
                    case ComparisonType.EqualTo: return datetimeValue == datetimeCompareValue;
                    case ComparisonType.GreaterThan: return datetimeValue.Value > datetimeCompareValue.Value;
                    case ComparisonType.GreaterThanOrEqualTo: return datetimeValue.Value >= datetimeCompareValue.Value;
                    case ComparisonType.LessThan: return datetimeValue.Value < datetimeCompareValue.Value;
                    case ComparisonType.LessThanOrEqualTo: return datetimeValue.Value <= datetimeCompareValue.Value;
                    case ComparisonType.NotEqualTo: return datetimeValue.Value != datetimeCompareValue.Value;
                }
            }

            // string compares
            switch ( compareType )
            {
                case ComparisonType.EqualTo: return value.Equals( compareValue, StringComparison.OrdinalIgnoreCase );
                case ComparisonType.GreaterThan: return value.CompareTo( compareValue ) > 0;
                case ComparisonType.GreaterThanOrEqualTo: return value.CompareTo( compareValue ) >= 0;
                case ComparisonType.LessThan: return value.CompareTo( compareValue ) < 0;
                case ComparisonType.LessThanOrEqualTo: return value.CompareTo( compareValue ) <= 0;
                case ComparisonType.NotEqualTo: return !value.Equals( compareValue, StringComparison.OrdinalIgnoreCase );
            }

            return false;
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:66,代码来源:ReportingExtensions.cs

示例5: ConditionMaterial

 public ConditionMaterial(string target, ComparisonType targetComp, string calc, int needCount,ComparisonType countComp)
 {
     Target = target;
     TargetComparison = targetComp;
     Calc = calc;
     NeedCount = needCount;
     CountComparison = countComp;
 }
开发者ID:EleBrain,项目名称:-CS-ZWJsonEditor,代码行数:8,代码来源:ConditionMaterial.cs

示例6: RangeIfClientAttribute

 public RangeIfClientAttribute(int minimum, int maximum, string otherProperty, ComparisonType comparisonType, object otherComparisonValue)
 {
     Minimum = minimum;
     Maximum = maximum;
     OtherProperty = otherProperty;
     ComparisonType = comparisonType;
     OtherComparisonValue = otherComparisonValue;
 }
开发者ID:danludwig,项目名称:UCosmic,代码行数:8,代码来源:RangeIfClientAttribute.cs

示例7: Comparison

 public Comparison(ComparisonType t, object controlTarget,
                   string controlXPath, object controlValue,
                   object testTarget, string testXPath,
                   object testValue)
 {
     type = t;
     control = new Detail(controlTarget, controlXPath, controlValue);
     test = new Detail(testTarget, testXPath, testValue);
 }
开发者ID:petergeneric,项目名称:xmlunit,代码行数:9,代码来源:Comparison.cs

示例8: ComparisonFilter

        /// <summary>
        /// 
        /// </summary>
        /// <param name="type"></param>
        /// <param name="value"></param>
        public ComparisonFilter(ComparisonType type, object value)
        {
            IComparable r1 = value as IComparable;
            if (value != null && r1 == null)
            {
                throw new ArgumentException("value is not IComparable", "value");
            }

            m_comparionType = type;
            m_value = r1;
        }
开发者ID:urmilaNominate,项目名称:mERP-framework,代码行数:16,代码来源:ComparisonFilter.cs

示例9: ExceptionExpectedAttribute

        /// <summary>Initializes a new instance of the <see cref="T:Microsoft.VisualStudio.TestTools.UnitTesting.ExpectedExceptionAttribute" /> class with and expected exception type and a message that describes the exception.</summary>
        /// <param name="exceptionType">An expected type of exception to be thrown by a method.</param>
        /// <param name="expectedMessage">Message expected to be returned in exception</param>
        /// <param name="comparisonType">The manner in which the message is evaluated</param>
        /// <param name="noExceptionMessage">The message to be displayed when no exception occurs in test</param>
        public ExceptionExpectedAttribute(Type exceptionType, string expectedMessage, ComparisonType comparisonType, string noExceptionMessage)
            : base(noExceptionMessage)
        {
            if (exceptionType == null)
                throw new ArgumentNullException(nameof(exceptionType));

            if (string.IsNullOrEmpty(expectedMessage))
                throw new ArgumentNullException(nameof(expectedMessage));

            ExceptionType = exceptionType;
            ExceptionMessage = expectedMessage;
            ExceptionComparisonType = comparisonType;
        }
开发者ID:gsteinbacher,项目名称:RandomOrgSharp,代码行数:18,代码来源:ExceptionExpected.cs

示例10: GetAccountRecordings

        /// <summary>
        /// Get account recordings
        /// </summary>
        /// <param name="dateCreated">Lists all recordings created on or after a certain date. </param>
        /// <param name="dateCreatedComparasion">Date created comparasion</param>
        /// <param name="page">Used to return a particular page withing the list.</param>
        /// <param name="pageSize">Used to specify the amount of list items to return per page.</param>
        /// <returns></returns>
        public async Task<RecordingResult> GetAccountRecordings(DateTime? dateCreated, ComparisonType? dateCreatedComparasion, int? page, int? pageSize)
        {
            var request = new RestRequest();
            request.Resource = RequestUri.AccountRecordingsUri;

            var dateCreatedParameterName = GetParameterNameWithEquality(dateCreatedComparasion, "DateCreated");

            if (dateCreated.HasValue) request.AddParameter(dateCreatedParameterName, dateCreated.Value.ToString("yyyy-MM-dd"));
            if (page.HasValue) request.AddParameter("Page", page);
            if (pageSize.HasValue) request.AddParameter("PageSize", pageSize);

            return await Execute<RecordingResult>(request);
        }
开发者ID:TelAPI,项目名称:telapi-dotnet,代码行数:21,代码来源:Recordings.cs

示例11: Like

 public static bool Like(this string source, string compareTo, ComparisonType comparisonType)
 {
     switch (comparisonType)
     {
         case ComparisonType.Contains:
             return source.Contains(compareTo);
         case ComparisonType.EndsWith:
             return source.EndsWith(compareTo);
         case ComparisonType.StartsWith:
             return source.StartsWith(compareTo);
         default:
             throw new InvalidOperationException();
     }
 }
开发者ID:lukesmith,项目名称:lix,代码行数:14,代码来源:StringExtensions.cs

示例12: Comparison

 public void Comparison(ComparisonType comp)
 {
   switch (comp)
   {
     case ComparisonType.Between:
       _writer.Write(" BETWEEN ");
       break;
     case ComparisonType.Contains:
     case ComparisonType.EndsWith:
     case ComparisonType.Like:
     case ComparisonType.StartsWith:
       _writer.Write(" LIKE ");
       break;
     case ComparisonType.Equal:
       _writer.Write(" = ");
       break;
     case ComparisonType.GreaterThan:
       _writer.Write(" > ");
       break;
     case ComparisonType.GreaterThanEqual:
       _writer.Write(" >= ");
       break;
     case ComparisonType.In:
       _writer.Write(" IN ");
       break;
     case ComparisonType.IsNotNull:
       _writer.Write(" IS NOT ");
       _writer.Null();
       _writer.Write(" ");
       break;
     case ComparisonType.IsNull:
       _writer.Write(" IS ");
       _writer.Null();
       _writer.Write(" ");
       break;
     case ComparisonType.LessThan:
       _writer.Write(" < ");
       break;
     case ComparisonType.LessThanEqual:
       _writer.Write(" <= ");
       break;
     case ComparisonType.NotEqual:
       _writer.Write(" <> ");
       break;
     case ComparisonType.NotLike:
       throw new NotSupportedException();
   }
   _lastComparison = comp;
 }
开发者ID:rneuber1,项目名称:InnovatorAdmin,代码行数:49,代码来源:BaseSqlCriteriaWriter.cs

示例13: NotenizerDependency

 public NotenizerDependency(
     NotenizerWord governor,
     NotenizerWord dependent,
     NotenizerRelation relation,
     int position,
     ComparisonType comparisonType,
     TokenType tokenType)
 {
     _governor = governor;
     _dependent = dependent;
     _relation = relation;
     _position = position;
     _comparisonType = comparisonType;
     _tokenType = tokenType;
 }
开发者ID:nemcek,项目名称:notenizer,代码行数:15,代码来源:NotenizerDependency.cs

示例14: GetData

        public ArrayList GetData(object key, ComparisonType comparisonType)
        {
            RedBlack.COMPARE compare = RedBlack.COMPARE.EQ;
            ArrayList result = new ArrayList();

            if (_rbTree != null)
            {
                switch (comparisonType)
                {
                    case ComparisonType.EQUALS:
                        compare = RedBlack.COMPARE.EQ;
                        break;

                    case ComparisonType.NOT_EQUALS:
                        compare = RedBlack.COMPARE.NE;
                        break;

                    case ComparisonType.LESS_THAN:
                        compare = RedBlack.COMPARE.LT;
                        break;

                    case ComparisonType.GREATER_THAN:
                        compare = RedBlack.COMPARE.GT;
                        break;

                    case ComparisonType.LESS_THAN_EQUALS:
                        compare = RedBlack.COMPARE.LTEQ;
                        break;

                    case ComparisonType.GREATER_THAN_EQUALS:
                        compare = RedBlack.COMPARE.GTEQ;
                        break;

                    case ComparisonType.LIKE:
                        compare = RedBlack.COMPARE.REGEX;
                        break;

                    case ComparisonType.NOT_LIKE:
                        compare = RedBlack.COMPARE.IREGEX;
                        break;
                }

                result = _rbTree.GetData(key as IComparable, compare) as ArrayList;
            }

            return result;
        }
开发者ID:christrotter,项目名称:NCache,代码行数:47,代码来源:RBStore.cs

示例15: GetConferences

        /// <summary>
        /// Return list of all conference resources associated with a given account
        /// </summary>
        /// <param name="friendlyName">List conferences with the given FriendlyName.</param>
        /// <param name="status">List conferences with the given status.</param>
        /// <param name="dateCreated">List conferences created on, after, or before a given date.</param>
        /// <param name="dateCreatedComparasion">Date range can be specified using inequalities.</param>
        /// <param name="dateUpdated">List conferences updated on, after, or before a given date.</param>
        /// <param name="dateUpdatedComparasion">Date range can be specified using inequalities.</param>
        /// <param name="page">Used to return a particular page withing the list.</param>
        /// <param name="pageSize">Used to specify the amount of list items to return per page.</param>
        /// <returns></returns>
        public ConferenceResult GetConferences(string friendlyName, ConferenceStatus? status, DateTime? dateCreated, ComparisonType? dateCreatedComparasion,
            DateTime? dateUpdated, ComparisonType? dateUpdatedComparasion, int? page, int?pageSize)
        {
            var request = new RestRequest();
            request.Resource = RequestUri.ConferencesUri;

            var dateCreatedParameterName = GetParameterNameWithEquality(dateCreatedComparasion, "DateCreated");
            var dateUpdatedParemeterName = GetParameterNameWithEquality(dateUpdatedComparasion, "DateUpdated");

            if (friendlyName.HasValue()) request.AddParameter("FriendlyName", friendlyName);
            if (status.HasValue) request.AddParameter("Status", status.ToString().ToLower());
            if (dateCreated.HasValue) request.AddParameter(dateCreatedParameterName, dateCreated.Value.ToString("yyyy-MM-dd"));
            if (dateUpdated.HasValue) request.AddParameter(dateUpdatedParemeterName, dateUpdated.Value.ToString("yyyy-MM-dd"));
            if (page.HasValue) request.AddParameter("Page", page);
            if (pageSize.HasValue) request.AddParameter("PageSize", pageSize);

            return Execute<ConferenceResult>(request);
        }
开发者ID:TelAPI,项目名称:telapi-dotnet,代码行数:30,代码来源:Conferences.cs


注:本文中的ComparisonType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。