码迷,mamicode.com
首页 > Windows程序 > 详细

关于mvc、webapi中get、post、put、delete的参数

时间:2014-11-06 16:26:18      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   os   sp   数据   div   问题   log   

webapi中post提交的数据必须是一个类,get提交的数量无所谓
多种参数get时,参数名不能相同:
在能通过c#的校验的前提下,参数名、参数数量不能全完相同
 
        public string Get(int page, int pagesize)
        {
            return "test1";
        }

        public string Get(int page)
        {
            return "test2";
        }

 

这是没问题的
 
        public string Get(int page, int pagesize = 10)
        {
            return "test1";
        }

        public string Get(int page)
        {
            return "test2";
        }

 

这种就会报错

关于mvc、webapi中get、post、put、delete的参数

标签:style   blog   color   os   sp   数据   div   问题   log   

原文地址:http://www.cnblogs.com/yeagen/p/4078836.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!