.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;
网友评论