- #1
- 463
- 44
I have a program that searches out string types.. Here is what I have so far -
C# language.
if(word.Contains "Hello")
{...}
else
if(word.Contains "Bye")
{...}
else
if(word.Contains "Yes")
{...}
...
I plan to add more and more of those if statements as my program advances. Would organizing these if statements in categories be worth it performance wise if I were to have thousands of them?
Here the program checks the first letter first in order to access different groups of ifs.
if(word[0] = 'a')
{
all if starting with 'a'
}
else
if(word[0] = 'b')
{
all if starting with 'b'
}
else
...
Thanks in advance
C# language.
if(word.Contains "Hello")
{...}
else
if(word.Contains "Bye")
{...}
else
if(word.Contains "Yes")
{...}
...
I plan to add more and more of those if statements as my program advances. Would organizing these if statements in categories be worth it performance wise if I were to have thousands of them?
Here the program checks the first letter first in order to access different groups of ifs.
if(word[0] = 'a')
{
all if starting with 'a'
}
else
if(word[0] = 'b')
{
all if starting with 'b'
}
else
...
Thanks in advance