c# linq select from object list
// this will return the first correct answer,
// or throw an exception if there are no correct answers
var correct = answers.First(a => a.Correct);
// this will return the first correct answer,
// or null if there are no correct answers
var correct = answers.FirstOrDefault(a => a.Correct);
// this will return a list containing all answers which are correct,
// or an empty list if there are no correct answers
var allCorrect = answers.Where(a => a.Correct).ToList();
Also in C#:
- c# copy file
- asp.net core task iactionresult
- Unity if object doens't exist
- unity multiplayer
- c# get list of all class fields
- add text to combobox c#
- c# make request to rest api
- ping with c#
- how to access the dictionary from another script in unity
- .net core identity get user id
- how to add a list to observablecollection in c#
- c# empty char
- unity up arrow input
- sort c#
- c# catch two exceptions in one block
- c# exit console
- c# authorize attribute
- loop gridcontrol devexpress c#
- print line in python
- c# how to convert string to int
- what is type unity
- c# convert excel column index to letter
- visual c#
- get number of sundays in a month c#