LINQ, can't join to string

后端 未结 3 545
暖寄归人
暖寄归人 2020-11-30 12:41

I have a list of users, each user has list of questions. In my model list of questions should be in string via comma. I try:

public List

        
3条回答
  •  日久生厌
    2020-11-30 13:20

    Try using the Aggregate method.

    Question4 = (from a in _dbContext.MultipleQuestions where a.MultipleQuestionType.KEY == MultipleQuestionKeys.BENEFITS select a.Question).ToArray().Aggregate((x,y) => x + "," + y)
    

    Have not tested

提交回复
热议问题