Suppose I have a method called ShowScores and all this method does is display each gamer's score. Basically there is a GamersRecords class which contains a list of records. Each record has GamersName and Score properties. I want to set to zero all the Scores that are below the Qualifying score of 50 using LINQ.
Below is what I've tried but I was not successful.
public class GamersRecords
{
public GamersRecords(List<Record> records)
{
this.Records = records;
}
public List<Record> Records{get;set;}
}
public class SomeClass
{
public ShowScores(GamersRecords records)
{
var newRecords = records.selectMany(g=>g.Score < 50).Score=0; foreach(newRecord in newRecords) { Console.WriteLine("Contestant's Name " + newRecord.GamersName + "Final Score" + newRecord.Score); }
}
}