我有这个 IEnumerable 类型的 Question.. 类 Question 具有属性 Question(string) 和 Id(int)
我想要做的是,如果 IEnumerable 中任何对象的问题的长度> 25,那么“子字符串”它并添加“...”
所以我的想法是这样的:
ienumQuestions.Where(e=>e.Question.Length > 25).Change(e.Question=>e.Question.Substring(25)+"...");
现在我不确定该语法是否 100% 正确,但我希望你明白这一点..
有没有办法做到这一点?..我真的不想为此创建一个循环..因为我根本不喜欢循环:)
提前致谢!