本文最后更新于 2023-10-18,文章内容可能已经过时。

关于.Net core 开发项目时遇到的一些问题及解决方案

.Net core 从json文件中去取json数组中的对象

var res = _config.GetSection("doors").GetChildren().Select(x=>new {
doorName=x.GetValue<string>("doorName"),
controllerIP = x.GetValue<string>("controllerIP"),
port = x.GetValue<string>("port"),
SN = x.GetValue<string>("SN"),
channel = x.GetValue<string>("channel"),
}).ToList();

用MemoryStream 返回文件流的时候,流的起始位置一定要置为0

MemoryStream ms = new MemoryStream();
ms.Seek(0, SeekOrigin.Begin);
workbook.Write(ms);
ms.Position = 0;

©著作权归作者所有,转载或内容合作请联系作者