Consider your string comparison case insensitive.
username.Equals(userList[i].ToString(), StringComparison.OrdinalIgnoreCase);
Or, if all the elements in your ArrayList user list are strings, and you are using .NET 3.5 or later, you can simplify this with LINQ:
public bool check_username(ArrayList userList, string username) { return userList.Cast<string>() .Any(s => s.Equals(username, StringComparison.OrdinalIgnoreCase); }
Adam rackis
source share