fork download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string str =
  9. @"
  10. hello world!
  11. foo bar
  12. test everything.is okay
  13. blah blah
  14. ";
  15.  
  16. var dict =
  17. str.Split(new char[] {'\r', '\n'}, StringSplitOptions.RemoveEmptyEntries)
  18. .Select(x => x.Split(new char[] {' '}, 2))
  19. .ToDictionary(x => x[0], x => x[1]);
  20.  
  21. Console.WriteLine(dict["test"]);
  22. }
  23. }
Success #stdin #stdout 0.03s 34000KB
stdin
Standard input is empty
stdout
everything.is okay