2016-02-09 75 views
-1

我想从我的C#控制器中的Json数组中检索值。这是我的json数组:C#从Json数组中检索值

{ 
    name : "Name 1", 
    description : "Description 1", 
    count : 6 
    } 

我如何检索我的c#控制器中的每个属性?我知道如何处理对象,但是这个json不是来自对象。

public IList[] getList(IList[] myList) 
     { 
    // How to get the value of the name and the description here ? 

} 
+0

要多少代码做一个简单的任务!我将最终创建一个具有所有我需要的属性的类,然后以这种方式检索它们:myList.name,myList.description等 – user708683

回答

1

我将最终创建一个我需要的所有属性的一类,然后检索他们以同样的方式我做一个对象:

CustomClass myClass ; 

string name = myClass.name 
string description = myClass.description; 
int count= myClass.count 
...