fork download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. public class Test
  6. {
  7. class Data {
  8. public int index;
  9. public string[] types;
  10. }
  11.  
  12. public static void Main()
  13. {
  14. List<Data> dataList = new List<Data>();
  15.  
  16. dataList.Add(new Data(){index = 1, types = new string[]{"street_number", "tits_size"}});
  17. dataList.Add(new Data(){index = 2, types = new string[]{"route", "ass_size"}});
  18. dataList.Add(new Data(){index = 3, types = new string[]{"street_number"}});
  19. dataList.Add(new Data(){index = 4, types = new string[]{"locality"}});
  20.  
  21. var neededData = dataList.FindLast(data => data.types.Contains("street_number"));
  22.  
  23. Console.WriteLine(neededData.index);
  24. }
  25. }
Success #stdin #stdout 0.01s 131776KB
stdin
Standard input is empty
stdout
3