Method_1 receives data from the site in the variable "var"

var resultRepo = await client_cur.Search.SearchRepo(request_repo); 

In the "var resultRepo" there is a collection of objects with properties.

I plan to extract the objects and its properties in the "DataTable", and then display it in the "dataGridView" using pagination.
To implement the above, it is assumed to use the method "Method_2".

Question.
How to transfer "var resultRepo" in "Method_2"?

The code is used from here - link

Preliminary code

 public void method_1(string searchQuery_str) { // Поиск по "Репозитариям" request_repo = new SearchRepositoriesRequest(searchQuery_str); // mvc client side framework - Структура клиентской стороны mvc var resultRepo_1 = client_cur.Search.SearchRepo(request_repo); return resultRepo_1; } public void method_2(var resultRepo_1) { var resultRepo_2 = resultRepo_1; } private void button1_Click(object sender, EventArgs e) { string searchQuery_str = textBox1.Text; method_1(searchQuery_str); } private void button2_Click(object sender, EventArgs e) { method_2(resultRepo_1); } 

enter image description here

enter image description here

  • Comments are not intended for extended discussion; conversation moved to chat . - Yuriy SPb

1 answer 1

Hover the variable cursor.
Defined the type.
Type - SearchRepositoryResult , library octokit.net .

 public void method_1(string searchQuery_str) { // Поиск по "Реозитариям" request_repo = new SearchRepositoriesRequest(searchQuery_str); // mvc client side framework - Структура клиентской стороны mvc resultRepo_1 = client_cur.Search.SearchRepo(request_repo).Result; } public void method_2(SearchRepositoryResult resultRepo_1) { resultRepo_2 = resultRepo_1; } private void button1_Click(object sender, EventArgs e) { string searchQuery_str = textBox1.Text; method_1(searchQuery_str); } private void button2_Click(object sender, EventArgs e) { method_2(resultRepo_1); }