gpt4 book ai didi

linq - 在 List<> 上调用 Linqpad 的 .Dump() 方法时,如何为结果集命名?

转载 作者:行者123 更新时间:2023-12-04 18:33:01 25 4
gpt4 key购买 nike

假设我做了以下查询表达式:

var clients =  
(from c in Clients
where (c.Age == 20)
select new { c.FirstName, c.LastName }
).ToList();

在 Linqpad 中调用 clients.Dump() 会在结果面板中显示以下内容:

List<> (5 items)

有没有办法重命名集合的标题,比如说“客户”,而不是“列表<>(5个项目)”?

最佳答案

header 指示类型,因此您不能在不更改集合类型的情况下对其进行重命名。相反,您通常会使用标题调用 .Dump :

clients.Dump ("clients")

然后你会得到一个标题为“客户”的列表。

关于linq - 在 List<> 上调用 Linqpad 的 .Dump() 方法时,如何为结果集命名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37075845/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com