WebAPI点滴

十年热恋 提交于 2019-11-26 07:42:09

 

//请求的URL是http://localhost:62032/api/Student/Get
         public Student Get()
        {
            return new Student() { ID = 1, name = "vichin" };
        }
//返回的是
<Student xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Demo4WebAPI.Models">
<ID>1</ID>
<name>vichin</name>
</Student>


//请求的URL是http://localhost:62032/api/Student/Get?name=vichin
        public string Get(string name)
        {
            return "你的名字叫:" + name;
        }    
//返回的是
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">你的名字叫:vichin</string>

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!