Convert a list of objects to an array of one of the object's properties

后端 未结 4 1036
名媛妹妹
名媛妹妹 2020-12-07 13:42

Say I have the following class:

public class ConfigItemType
{
    public string Name { get; set; }
    public double SomeOtherThing { get; set; }
}
         


        
4条回答
  •  半阙折子戏
    2020-12-07 14:21

    This should also work:

    AggregateValues("hello", MyList.ConvertAll(c => c.Name).ToArray())
    

提交回复
热议问题