c# - Search through a list or an array for existing string -


I need an array or list that will include the name that will add the user. I also need to do an investigation which will not allow the name to be added, if that name is already present, I know it should be very simple, but I can not find a solution.

I think if it can:

  List.Contains (name))   

Or:

  if (array (name))   

this It is as easy as that! List and T [] both IList & lt; T & gt; Apply the interface with your method. Assuming that you are happy with an accurate match, of course. If you need some more complex, then I might use it from LINQ to Any for example:

  if (array.Any (x => x .tartsWith (name))    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -