PC Review


Reply
Thread Tools Rate Thread

Fast String Comparison

 
 
Derek Hart
Guest
Posts: n/a
 
      28th Feb 2009
I need a fast way to compare strings. I have a custom designer where users
move around controls on screen, and the Microsoft property grid fills with
the properties when each control is selected, just like in Visual Studio.
After the grid is filled, I then run code to hide properties that I do not
want to be visible. I know I can do this before the grid is built, but that
will not work here. It has to happen after the grid is built.



I will have an array, or an xml file, or some type of way of storing
information such as Font.Bold or MaximumSize.Height, for example. I will
have about 1000 of these items. After the property grid is filled, I will
then loop through the grid, hiding properties that are in this list of 1000
items. Every property in the grid will be looped, and each time I need to
see if the property exists in the list of 1000 items. This is easy to do in
different ways, but I need a speedy way. Any ideas?



I could even store the 1000 items as one big string, and use IndexOf to see
if the string is there. Help...


 
Reply With Quote
 
 
 
 
BobRoyAce
Guest
Posts: n/a
 
      28th Feb 2009
Well, presumably, you have a list of properties that you want to hide.
Store those in a hashtable, or a collection. Then, cycle through all
the properties in your grid. If you find it in the hashtable/
collection, hide it; otherwise show it. In this way, you only cycle
through each item in the grid once.
 
Reply With Quote
 
 
 
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      28th Feb 2009
Derek,

Your Grid is a user interface. The human eye cannot recognize a change in
0.05 second.
Therefore every computer is fast enough to do this even at the moment that
it is enterered in the grid.
(A kind of self made FindsSringExact method)

As you do not do it while entering then you can use that FindStringExact
metod in a loop.

You can do it with Linq distinc as well, but that will probably do it the
same.

Cor

"Derek Hart" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I need a fast way to compare strings. I have a custom designer where users
>move around controls on screen, and the Microsoft property grid fills with
>the properties when each control is selected, just like in Visual Studio.
>After the grid is filled, I then run code to hide properties that I do not
>want to be visible. I know I can do this before the grid is built, but that
>will not work here. It has to happen after the grid is built.
>
>
>
> I will have an array, or an xml file, or some type of way of storing
> information such as Font.Bold or MaximumSize.Height, for example. I will
> have about 1000 of these items. After the property grid is filled, I will
> then loop through the grid, hiding properties that are in this list of
> 1000 items. Every property in the grid will be looped, and each time I
> need to see if the property exists in the list of 1000 items. This is easy
> to do in different ways, but I need a speedy way. Any ideas?
>
>
>
> I could even store the 1000 items as one big string, and use IndexOf to
> see if the string is there. Help...
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
False Positives From String Comparison using string.Equals() Smithers Microsoft ASP .NET 12 7th Jul 2009 02:23 AM
Fast String Comparison Derek Hart Microsoft Dot NET 2 28th Feb 2009 10:18 AM
Fast processor, fast memory and fast graphics but crap Windows smooth scroll beemer Windows XP General 11 14th Nov 2008 11:05 AM
comparison string object to string array... David Lazos Microsoft C# .NET 8 14th Jul 2008 12:18 PM
I NEED HELP FAST FAST FAST =?Utf-8?B?QW1hem9uU2FtdXJhaQ==?= Windows XP Performance 3 24th Jul 2006 01:07 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:29 PM.