WebAPI点滴

//请求的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>

猜你喜欢

转载自www.cnblogs.com/vichin/p/11317001.html