jeudi 3 décembre 2015

How do I convert a value from Random to a string?

I'm new to c# and I would like to use a value that a random method would give me from an actual array list. But I can't seem to convert it or use a console.readline() on it. Here goes my code.

static void Main(string[] args)
        {
            string[] mots = new string[] { "pomme", "animal", "pont", "ensemble", "visuel", "acronyme", "cellule", "article", "syllable", "programme" };
            Random mot = new Random(mot.GetHashCode());
            mot = Console.ReadLine();
            Console.WriteLine(mots[mot.Next(9)]);

            string mot = "pomme";
            char[] charArray = mot.ToCharArray();
            Array.IndexOf(charArray);
} 

How do I convert the output into a string in order to use it afterwards? Thank you.




Aucun commentaire:

Enregistrer un commentaire