我正在嘗試將var參數傳遞給方法:class Program{ static void Main() { var client = new RestClient("http://example.com"); var request = new RestRequest("resource/{id}", Method.POST); var response = client.Execute(request); PrintResponseStuff(response); } public static void PrintResponseStuff(var response) { Console.WriteLine(response.StatusCode); Console.WriteLine(response.StatusDescription); Console.WriteLine(response.IsSuccessful); Console.WriteLine(response.Content); Console.WriteLine(response.ContentType); }}最簡單的方法是傳遞一個 var;但是,如果有一種數據類型可以保存request它也應該有效。無論如何要這樣做還是我需要單獨傳遞每個項目?
- 3 回答
- 0 關注
- 712 瀏覽
添加回答
舉報
0/150
提交
取消