Horje
select a object from list based on a value csharp Code Example
select a object from list based on a value csharp
// 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();




Csharp

Related
words counter c# Code Example words counter c# Code Example
how to write a variable in console c# Code Example how to write a variable in console c# Code Example
how to get element dictionary key in c# by index Code Example how to get element dictionary key in c# by index Code Example
c# string replace with empty char Code Example c# string replace with empty char Code Example
c# unity detect any keyboard input Code Example c# unity detect any keyboard input Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
12