Completed
Last Updated: 15 Feb 2019 16:46 by ADMIN
Tomislav
Created on: 12 Feb 2019 14:37
Category: UI for WinForms
Type: Feature Request
1
AutoCompleteSuggestHelper, DefaultFilter, Assembly: Telerik.WinControls.UI, Version=2019.1.117.40

AutoCompleteSuggestHelper, Assembly: Telerik.WinControls.UI, Version=2019.1.117.40

 

Isnt the hilighted line (contains branch) very unoptimized.

https://rhale78.wordpress.com/2011/05/16/string-equality-and-performance-in-c/

Multiple ToLower string operation. Why not let the framework do the operation since you are always using ordinal?

optimized version: return item.Text.Contains(this.Filter, StringComparison.OrdinalIgnoreCase);


 

protected virtual bool DefaultFilter(RadListDataItem item)
    {
      switch (this.suggestMode)
      {
        case SuggestMode.StartWiths:
          return item.Text.StartsWith(this.Filter, this.StringComparison);
        case SuggestMode.Contains:
          if ((this.StringComparison & StringComparison.InvariantCultureIgnoreCase) == StringComparison.InvariantCultureIgnoreCase || (this.StringComparison & StringComparison.InvariantCultureIgnoreCase) == StringComparison.CurrentCultureIgnoreCase)
            return item.Text.ToLower().Contains(this.Filter.ToLower());
          return item.Text.Contains(this.Filter);
        default:
          return item.Text.StartsWith(this.Filter, this.StringComparison);
      }
    }

 

2 comments
Dimitar
Posted on: 15 Feb 2019 16:46
Hello,

A fix will be available in Telerik UI for WinForms version R1 2019 SP1.

Regards,
Dimitar
ADMIN
Dimitar
Posted on: 13 Feb 2019 12:21
Hello Tomislav,

I have approved the item and updated your Telerik Points.

Should you have any other questions do not hesitate to ask.
 
Regards,
Dimitar
Progress Telerik
Get quickly and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.