I am trying to convert a list that I pulled from an API and convert it to a list. The list does return other data but i have code in there to return just the data I want( it could be wrong)
//this pulls the data
public List<AccountBalance> CorpAccounts(int CORP_KEY, string CORP_API, int USER)
{
List<AccountBalance> _CAccount = new List<AccountBalance>();
EveApi api = new EveApi(CORP_KEY, CORP_API, USER);
List<AccountBalance> caccount = api.GetCorporationAccountBalance();
foreach (var line in caccount)
{
//everyting after
string apiString = line.ToString();
string[] tokens = apiString.Split(' ');
_CAccount.Add(line);
}
return _CAccount;
}
//I am trying to convert the list to the array here
private void docorpaccounts()
{
string[] corpbal = cwaa.CorpAccounts(CORP_KEY, CORP_API, USER).ToArray();
}
With that code I get this error:
Error 1 Cannot implicitly convert type 'EveAI.Live.AccountBalance[]' to 'string[]'
Not sure what I am doing wrong here.
AccountBalance[]instead ofstring[].List<AccountBalance> _CAccount = new List<AccountBalance>();toList<string> _CAccount = new List<string>();. And alsopublic List<AccountBalance> CorpAccounts()topublic List<string> CorpAccounts. That's one way you could fix your problem