You dealing with type string
not char
. So update single quotes to double quotes:
foreach (User user in this.oSkype.Friends)
{
if (user.OnlineStatus == "olsOffline") {
this.listBoxControl1.Items.Add(user.Handle + " Offline");
} else {
this.listBoxControl1.Items.Add(user.Handle + " Online");
}
}
1
solved if statement in a foreach loop c# [closed]