I have the following object in a list:
public class DemoClass { public int GroupKey { get; set; } public string DemoString { get; set; } public o
You already made it a one-liner. Just put the ToDictionary at the end of your first line. If you want it to be shorter, use the functional composition syntax instead of the query syntax.
ToDictionary