This question already has an answer here:
- I have a text file, which contains [WORDS - MEANING].
This has been split into a 2D array. One column for words, the other for meaning. The rows in this array are list.Length (however long my list is).
// Assigning text file to variable
string path1 = @"C:\File1.txt";
// Creating a 2D array for the contents to go into
string[,] wordAndMeaning = new string [path1.length, 2];
(Just including this to give a bit of a visual to how my array is looking)
- My aim is to grab a RANDOM word, with the corresponding MEANING from the list.
(The array is correctly sorted and working. Words[10] contains the corresponding meaning in Meaning[10] for example).
My question is how can I create a class, with a method inside which pulls a new random word from the 2D array each time it is called, with the corresponding meaning to go with it.
Thanks (I am a beginner - answers/code with a little extra explanation will be greatly appreciated).
Aucun commentaire:
Enregistrer un commentaire