I have a string _Users
of type List
, it contains several lines.
Each line consists of an integer and a comma-separated string (usually just a string): ID (numbers only), name (letters and numbers ).
What I'm trying to do is find in which line the ID is located.
If I want to find the index of ID 1, the Contains()
function will return the first line that contains "1", this will disturb if there is a named user, for example: "joao123".
int i = _Users.FindIndex(a => a.Contains(UserID.ToString()));
var dados = _Users[i];
string[] dado = dados.Split(',');