C# 7.0 Value Tuple compile error? C# 7.0 Value Tuple compile error? asp.net asp.net

C# 7.0 Value Tuple compile error?


It works for me, create a tuple first and convert it to a ValueTuple:

var post = iPostService.GetAll().           Select(x => new Tuple<string, string>(x.Title, x.Author).ToValueTuple())


Finally, I found out what wrong with my code:

  • I am using deferred execution so data won't load from the database when the constructor executed.
  • The solution is to add conversion operators before creating instance command.

Hope it works with your code.