Question: You are developing a method that searches a string for a substring. The method will be localized to Italy.
Your method accepts the following parameters:
The string to be searched, which is named searchList
The string for which to search, which is named searchValue
You need to write the code.
Which code segment should you use?
A
B
C
D
CompareInfo comparer =
new CultureInfo("it-IT").CompareInfo;
if (comparer.IndexOf(searchList,
searchValue) > 0) {
return true;
} else {
return false;
}
new CultureInfo("it-IT").CompareInfo;
if (comparer.IndexOf(searchList,
searchValue) > 0) {
return true;
} else {
return false;
}
B
CultureInfo comparer = new CultureInfo("it-IT");
if (searchList.IndexOf(searchValue)
> 0) {
return true;
} else {
return false;
}
if (searchList.IndexOf(searchValue)
> 0) {
return true;
} else {
return false;
}
C
CompareInfo comparer =
new CultureInfo("it-IT").CompareInfo;
return comparer.Compare(searchList, searchValue);
new CultureInfo("it-IT").CompareInfo;
return comparer.Compare(searchList, searchValue);
D
return searchList.IndexOf(searchValue);
Note: Not available