vendredi 30 juin 2017

Check List elements in C# and Python

I have worked on Python and I am new in C#. I am trying to get familier with syntaxes and concepts. I have a problem with list.

For example, I will take a word from user. I will add it to a list and I will check if it is entered before because user can't give the same word second time. If it is not entered before add it to the list. If is is already in the list pass it.

In python:

check_list = list()
if word not in check_list:
    check_list.append(word)
else:
    pass

How can I do that in C# ???

Aucun commentaire:

Enregistrer un commentaire