How to search a string in String array

Well, something is going to have to look, and looping is more efficient than recursion (since tail-end recursion isn’t fully implemented)… so if you just don’t want to loop yourself, then either of:

bool has = arr.Contains(var); // .NET 3.5

or

bool has = Array.IndexOf(arr, var) >= 0;

For info: avoid names like var – this is a keyword in C# 3.0.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)