c# - Cannot Convert Type Void to Generic List -


I have two lists: a list of countries and jobs

  public list & Lieutenant; Countries & gt; getSharedCountries (string brand name) {var items = SharedJobs.Where (a => a.brandName == brandName); Var items2 = items.OrderBy (a => a.CountryCode); Country = new list & lt; Country & gt; (); String country = null; Foreach (item 2 items) {if (Country! = Item.CountryCode) {Country = item.CountryCode; Country. Add (New Country () {Contra Contd = Item. County Code, Job Id = Meet Sherzb (Item Country Code)}); }} Return Country; } Public Zero getSharedJob (String Country) {var items = SharedJobs.Where (a => a.CountryCode == country); JobNetDetails = New list & lt; JobDetail & gt; (); CareerBoardDetails = New List & lt; JobDetail & gt; (); JobSharkDetails = New list & lt; JobDetail & gt; (); JobServeDetails = New list & lt; JobDetail & gt; (); Int AusCount = 0; Foreign items (different items in items) {if (country == "AUS") {AusCount ++; If (AusCount% 4 == 0) {JobNetDetails.Add (New JobDetail () (JobPageTitle = item.JobPageTitle, JobID = item.JobID, JobUrl = item.JobUrl});} Else {JobServeDetails.Add (New JobDetail () {JobPageTitle = item.JobPageTitle, JobID = item.JobID, JobUrl = item.JobUrl});}}}}   

I'm getting the method, where get the line on the board when it's Errors and error gives me, but can not convert void into system.generic.list?

Why am I confused as to why this is happening?

As the signature of your method, Public Zero Received sharedJob (string country) This is zero, so it does not return anything, you should change it and return the desired list.

Edit: As I Read the comments you need to return 4 lists

  • You can return a list of lists;
  • You can return your own 4 categories of lists.

  • Comments

    Popular posts from this blog

    Java - Error: no suitable method found for add(int, java.lang.String) -

    java - JPA TypedQuery: Parameter value element did not match expected type -

    c++ - static template member variable has internal linkage but is not defined -