I have the following code:
IList<Question> oldObj = _questionService.GetQuestions(id);
The Question class has a field of QuestionId.
Can someone tell me how can I get a console list of all the QuestionIds
You can create a single string for the QuestionIDs
separated by NewLine
using string.Join
and can output using Console.WriteLine
Console.WriteLine(string.Join
(Environment.NewLine, oldObj.Select(r=> r.QuestionId)));
For Web application/ ASP.Net:
System.Diagnostics.Debug.WriteLine(string.Join
(Environment.NewLine, oldObj.Select(r=> r.QuestionId)));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.