How to convert object to Dictionary in C#?

前端 未结 15 1793
隐瞒了意图╮
隐瞒了意图╮ 2020-12-13 17:58

How do I convert a dynamic object to a Dictionary in C# What can I do?

public static void MyMethod(object obj)
{
    if (typ         


        
15条回答
  •  南笙
    南笙 (楼主)
    2020-12-13 18:03

       public static void MyMethod(object obj){
       Dictionary dicEditdata = data as Dictionary;
       string abc=dicEditdata["id"].ToString();} 
    

    suppose--- if you place the cursor over the object(obj) while debugging and if you get an object with the value {['id':'ID1003']} then you can use the value as

    string abc=dicEditdata["id"].ToString(); 
    

提交回复
热议问题