I'm trying to convert my list to a string array. My list is contains the following:
public class AcctList
{
public string sRole { get; set; }
public bool bIsPrimary { get; set; }
public int iDayNo { get; set; }
public bool bIsAirportMeetGreet { get; set; }
public bool bIsSeaportMeetGreet { get; set; }
}
I then try to convert the list to a string array by doing the following:
List<AcctList> userAccount = AccountBLL.GetUserInfoListByName(sUser);
String[] array = userAccount.ToArray();
However I cannot convert the list to an array. What can I do so that my list can be converted to an array?
AcctListto array ofstring. The same way you can't convert a singleAcctListto a singlestring. You have to say how that kind of conversion should be performed first. Do you want to serializeAcctListinstance into XML/JSON? Do you want just one property out of that object? Something else? Compiler will not make guesses here. Neither will I.