你的位置: 码友网首页 / 资讯源列表 / Best way to create an empty collection (array and list) in C# (.NET)

关于[Best way to create an empty collection (array and list) in C# (.NET)]的摘要:

I one of APIs I was working a while back I needed to return an empty collection. It was not a performance critical code, yet I decided what would be the best way to do it. Exploring and learning. The signature required me to return List, but I started with testing arrays first. I expected Array.Empty to be clear winner, but I was also interested how other “common” ways stack up.

原文地址: https://www.tabsoverspaces.com/233833-best-way-to-create-an-empty-collection-array-and-list-in-csharp-net

收录时间: 2020-08-05 浏览量: 1777 分类: .NET

| 0 收藏 | 0