Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Fast String Comparison

Reply
 
Old 02-27-2009   #1 (permalink)
Derek Hart


 
 

Fast String Comparison

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...



My System SpecsSystem Spec
Old 02-27-2009   #2 (permalink)
BobRoyAce


 
 

Re: Fast String Comparison

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.
My System SpecsSystem Spec
Old 02-28-2009   #3 (permalink)
Cor Ligthert[MVP]


 
 

Re: Fast String Comparison

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" <derekmhart@xxxxxx> wrote in message
news:ujxyuMVmJHA.5620@xxxxxx
Quote:

>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...
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Fast way to determine if a string contains a member of a list of strings .NET General
Fast byte array comparison for ordering purposes .NET General
problems with $var | select-string -pattern $string -q PowerShell
How export-csv deals with string versus string[] PowerShell
String PRODUCT_NAME was not found in string table Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46