首页 > 编程语言 >C# Newtonsoft中JArray 转成泛型List

C# Newtonsoft中JArray 转成泛型List

时间:2023-02-15 16:01:49浏览次数:36  
标签:Newtonsoft C# 写法 JArray var data

错误写法:

  var data = new JArray() {"hello","world" };
  var list = data.ToList<string>();

以上写法会提示错误如下:

正确写法:

var data = new JArray() {"hello","world" };
var list = data.ToObject<List<string>>();

标签:Newtonsoft,C#,写法,JArray,var,data
From: https://www.cnblogs.com/qingheshiguang/p/17123341.html

相关文章