Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Testing list
//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 Program { public static void Main(string[] args) { var lstProducts = new List<Product>(); lstProducts.Add(new Product(){Id= 1, Name= "Name 1"}); lstProducts.Add(new Product(){Id = 2, Name= "Name 3"}); lstProducts.Add(new Product(){Id= 3, Name= "Name 3"}); lstProducts.Add(new Product(){Id= 4, Name= "Name 4"}); lstProducts.Add(new Product(){Id= 5, Name= "Name 5"}); foreach(var item in lstProducts){ if(item.Id == 2){ //var item3 = lstProducts.FirstOrDefault(r=>r.Id == 3); //lstProducts.Remove(item3); continue; } Console.WriteLine("Hello, world! ==> " + item.Id); } } } public class Product { public int Id {get;set;} public string Name {get;set;} } }
run
|
edit
|
history
|
help
0
Plt-D v.0.9.5
Test date/time bug
NumberSeenSample
Program A
sum 2
Dependency Injection
LCM Q 3
abebe
asxasxasd
Merging and sorting 2 arrays using LINQ