public void MatchListhWords() { if (QuestionSet1 != null && QuestionSet2 != null && QuestionSet2.Count > 0 && QuestionSet1.Count > 0) { var joined = QuestionSet1.Zip(QuestionSet2, (x, y) => new { x, y }); var shuffled = joined.OrderBy(x => Guid.NewGuid()).ToList(); var MatchedQuestionSet11 = shuffled.Select(pair => pair.x).ToList(); MatchedQuestionSet1 = Shuffle(MatchedQuestionSet11); MatchedQuestionSet2 = shuffled.Select(pair => pair.y).ToList(); //MatchedQuestionSet2 = Shuffle(MatchedQuestionSet22); List <RandomNumbers> MainRandomList = new List <RandomNumbers>(); for (int i = 0; i < MatchedQuestionSet1.Count; i++) { RandomNumbers randomList = new RandomNumbers(); randomList.Item1 = MatchedQuestionSet1[i]; randomList.Item2 = MatchedQuestionSet2[i]; MainRandomList.Add(randomList); } GetMatchItems = new ObservableCollection <RandomNumbers>(MainRandomList); } else { CoreMethods.DisplayAlert("Both Editor boxes Should not be empty!", "Please Enter Something else", "Ok"); } //return matchword; }
public static void MatchListhWords() { var joined = QuestionSet1.Zip(QuestionSet2, (x, y) => new { x, y }); var shuffled = joined.OrderBy(x => Guid.NewGuid()).ToList(); MatchedQuestionSet1 = shuffled.Select(pair => pair.x).ToList(); MatchedQuestionSet2 = shuffled.Select(pair => pair.y).ToList(); //return matchword; }