0

I search for repositories according to the documentation. https://github.com/octokit/octokit.net/blob/master/docs/search.md
How to get at least some data on the repository license?
I mean get data from this page. enter image description here

Or the content of the file - "LICENSE.txt"

I need information from any of the areas indicated in the figure.
I try to do on using the code, but I don’t understand how to do it correctly

var repoLicen = client.Repository.GetLicenseContents("octokit", "octokit.net");  
var licen = repoLicen.li???  
smolchanovsky
  • 1,775
  • 2
  • 15
  • 29

1 Answers1

0

Try this:

var licenseContents = github.Repository.GetLicenseContents("octokit", "octokit.net").Result;

GetLicenseContents returns Task this means that the method is asynchronous. https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/

smolchanovsky
  • 1,775
  • 2
  • 15
  • 29
  • What do you want to say about the asynchronous method? I did this (see the code). Correctly? Or it is possible to do more correctly? `private async void licens() { var repoLicen = client.Repository.GetLicenseContents("octokit", "octokit.net").Result; string licenName = repoLicen.License.Name.ToString(); } private async void button12_Click(object sender, EventArgs e) { licens(); }` I'm starting to figure out programming. I apologize if the question is incorrect – user9832524 Oct 09 '18 at 21:02
  • Use `private async Task licens() => await client.Repository.GetLicenseContents("octokit", "octokit.net");` – smolchanovsky Oct 09 '18 at 21:08