简体   繁体   中英

Convert <Anonymous Type> to Model class type in web api

I am using c# prog with web API new,

I have created a common return type class and it will return some list in dynamical value. I am created login control to check a password getting from SP. I am struck how yo convert to class dynamic value to the class. Please find the image. Please help me how to get haspassword and token properties

在此处输入图片说明

    {
        public dynamic ValList { get; set; }
        public string ErrorCode { get; set; }
        public string ErrorMessage { get; set; }
    }

You can get password and token like this

string password = ObjcommonReturnTypes.ValList.ObjloginoutPutToken.HasPassword.ToString();
string token = ObjcommonReturnTypes.ValList.ObjloginoutPutToken.TokenVal.ToString();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM