fork(1) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class Test
  6. {
  7. class Cardtable
  8. {
  9. public int id { get; set; }
  10. public string cardno { get; set; }
  11. }
  12.  
  13. public static void Main()
  14. {
  15. List<Cardtable> cardtable = new List<Cardtable>();
  16.  
  17. cardtable.Add(new Cardtable() { id = 1, cardno = "0001-1234-5678-9001" });
  18. cardtable.Add(new Cardtable() { id = 2, cardno = "0001-1234-5678-9002" });
  19.  
  20. string search_string = "0001-1234-5678-9002";
  21. var result = from c in cardtable
  22. where c.cardno.Replace("-", "") == search_string.Replace("-", "")
  23. select c;
  24.  
  25. foreach (Cardtable ct in result)
  26. {
  27. Console.WriteLine("{0}:{1}", ct.id, ct.cardno);
  28. }
  29. }
  30. }
Success #stdin #stdout 0.03s 34016KB
stdin
Standard input is empty
stdout
2:0001-1234-5678-9002