First of all - I know this question has been asked. I hardly know C# still learning, a lot of this code is from a tutorial, so I was hoping if I could have a more of direct answer to my actual code. Im making a twitch bot.
private void ViewListUpdate()
{
ViewerBox.Items.Clear();
Chatters AllChatters = ChatClient.GetChatters("name");
chatBox.Text += "Checking the viewer list...";
foreach (string admin in AllChatters.Admins)
{
ViewerBox.Items.Add(admin + Environment.NewLine);
}
foreach (string staff in AllChatters.Staff)
{
ViewerBox.Items.Add(staff + Environment.NewLine);
}
foreach (string globalmod in AllChatters.GlobalMods)
{
ViewerBox.Items.Add(globalmod + Environment.NewLine);
}
foreach (string moderator in AllChatters.Moderators)
{
ViewerBox.Items.Add(moderator + Environment.NewLine);
}
foreach (string viewers in AllChatters.Viewers)
{
ViewerBox.Items.Add(viewers + Environment.NewLine);
}
}
The line that is getting the error (System.IndexOutOfRangeException: 'Index was outside the bounds of the array.') is the following:
Chatters AllChatters = ChatClient.GetChatters("name");
Any help would be great, thanks.