运用Linq,将List<T> 转换为 Dictionary<T Key,T Value> 即:List<T> ToDictionary<T Key,T Value> 废话不说,看代码: 示例代码:按照性别分类 class Program { public class Student { public string Name { get; set; } public int Age { get; set; } public int Sex { get; s
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Dictionary<int, string> test = new Dictionary<int, string> { }; test.Add(,&
<script type="text/javascript"> getJson('age'); function getJson(key){ var jsonObj={"name":"傅红雪","age":"24","profession":"刺客"}; //1.使用eval方法 var eValue=eval('jsonObj.'+key); alert