vendredi 19 août 2016

if statement in a foreach loop c#

I want to add an if statement in this foreach loop but it obviously throws up errors.

Too many characters in character literal

This is what I did and what i want to achieve with this. is there a way i can do this? any help with this is much appreciated :D

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');
            }
        }

Aucun commentaire:

Enregistrer un commentaire