关于.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;
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容