Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Linq - When using FirstOrDefault, make sure to check for null result
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Thing { public string Name {get; set;} public decimal Value {get; set; } } public class Program { public static void Main(string[] args) { List<Thing> _myList = new List<Thing>() { new Thing() {Name = "A", Value = 1}, new Thing() {Name = "B", Value = 2} }; decimal myVal = _myList.FirstOrDefault(t => t.Name == "C").Value; } } }
run
|
edit
|
history
|
help
0
Interface referance variable
NumsToVars
seoituerwoi
pattern
s 3
Why Linqdb is cool if you are a Csharper
NeedFirst
Asignacion 692018
Number Comparer
binary search tree (insert, search, findmin, findmax, level-pre-in-post order traversals