- Регистрация
- 21.08.2013
- Сообщения
- 249
- Благодарностей
- 12
- Баллы
- 18
I am trying to check if my list contains a certain string and not only part of the string but the exact mach.
Live example:
My postLinks list has the following strings: "car", "house", "firecracker", "laptop", "mouse"
Using this c# Block Code I get unexpected results:
Now my questions are:
Why alreadyProcessed is true when checking car99 in postLinks?
Is the postLinks list the same as postLinks2 ?
I have also attached the test project below
Live example:
My postLinks list has the following strings: "car", "house", "firecracker", "laptop", "mouse"
Using this c# Block Code I get unexpected results:
Код:
IList<string> postLinks = project.Lists["postLinks"];
IList<string> postLinks2 = new List<string> (new string[] { "car", "house", "firecracker", "laptop", "mouse" });
//var postLinks = project.Lists["postLinks"];
bool alreadyProcessed;
string postLink = "car99";
alreadyProcessed = postLinks.Contains(postLink); //this is true even if "car99" is not in my list but only "car" is
alreadyProcessed = postLinks2.Contains(postLink); //this is false because in my manually defined list car99 doesn't exist
string ads = "dasD";// this is just dummy code so I can stay within the debug mode, so ignore it
Why alreadyProcessed is true when checking car99 in postLinks?
Is the postLinks list the same as postLinks2 ?
I have also attached the test project below
Вложения
-
10 КБ Просмотры: 191