[Solved] How to search as a dictionary in C# [closed]


You could use Array.FindIndex and do this.

var array = new string [] {"windows","dual sim","32 gb","Intel i5"};

string searchString = "android 32 gb";
var index = Array.FindIndex(array, x=> searchString.IndexOf(x) >=0);

if you are looking for case insensitive search, use this.

var index = Array.FindIndex(array, x=> searchString.IndexOf(x, StringComparison.CurrentCultureIgnoreCase) >=0);

Check this Demo

8

solved How to search as a dictionary in C# [closed]