'how to create a function question answer c#

how to create a function that associates the name of the player who was chosen randomly thanks to the function I created and to the name of the question which is generated randomly with another function that I created.
Do you have to create a Player id and a question id. I send you the code of the random functions. langage this variable liste contin player name

public static List<string> langage = new List<string>();

int index = Randomindex(langage.Count());

string Playername = langage.ElementAt(index)

public static int Randomindex(int mbplayers)
{
    var rand = new Random();
    int index = rand.Next();
    return index % mbplayers;
}

private List<Qes> qetquestion ()
{
    List<Qes> lesquestions = new List<Qes>();
    Qes qes1 = new Qes()
    {
        question = "Combien font 20 * 50",
        reponse = "1000"
    };
    Qes qes2 = new Qes()
    {
        question = "Quel est le prenom de bonarte",
        reponse = "Napoleon"
    };
    lesquestions.Add(qes1);
    lesquestions.Add(qes2);
    lesQuestions = lesquestions;
    return lesquestions;
}

public Qes getrandomQuestion()
{
    var random = new Random();
    var list = lesQuestions;
    int index = random.Next(list.Count);
    return list[index];
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source