简体   繁体   English

兑换 <Anonymous Type> Web API中的Model类类型

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

I am using c# prog with web API new, 我正在将c#prog与新的Web API一起使用,

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. 我创建了登录控件来检查从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 请帮助我如何获取haspassword和令牌属性

在此处输入图片说明

    {
        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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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