fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace TestThat
  6. {
  7. class MainClass
  8. {
  9. public static void Main (string[] args)
  10. {
  11. var theList = new [] {
  12. new { PartNumber="FID34" }
  13. };
  14.  
  15. var result = theList
  16. .Where (line => line.PartNumber.StartsWith("FID", StringComparison.CurrentCultureIgnoreCase))
  17. .OrderBy (line =>
  18. {
  19. int pnumber;
  20. return Int32.TryParse(line.PartNumber.Substring(3), out pnumber)
  21. ? pnumber
  22. : 0;
  23. });
  24.  
  25. }
  26. }
  27. }
  28.  
stdin
Standard input is empty
compilation info
prog.cs(15,29): warning CS0168: The variable `result' is declared but never used
Compilation succeeded - 1 warning(s)
stdout
Standard output is empty