I have two lists created from classes which contain two string variables each. I want to combine them into a third list, but it keeps giving me overload errors.
This third list is going to be sent into a JSON string and saved in a database.
Tell me where I’m blowing it.
New List Properties:
public class SheetJSON
{
public string MemberID{get; set;}
public string MemberName{get; set;}
public string EquipmentID{get; set;}
public string EquipmentDescription{get; set;}
public GigSheetJSON(string memberID, string memberName, string equipmentID, string equipmentDescription)
{
this.MemberID=memberID;
this.MemberName=memberName;
this.EquipmentID=equipmentID;
this.EquipmentDescription=equipmentDescription;
}
}
Main Script:
public List<Equipment> Equipment;
public List<Members> Members;
public List<SheetJSON> Sheet;
void Awake()
{
Equipment=new List<Equipment>();
Members=new List<Members>();
Sheet=new List<SheetJSON>();
}
// Use this for initialization
void Start ()
{
EnableButtons();
GetAllEquipment();
GetAllMembers();
}
void Testing()
{
Sheet.AddRange(Members);
Sheet.AddRange(Equipment);
Sheet.Sort();
}
Errors:
The best overloaded method match for `System.Collections.Generic.List.AddRange(System.Collections.Generic.IEnumerable)’ has some invalid arguments
Argument #1' cannot convert
System.Collections.Generic.List’ expression to type `System.Collections.Generic.IEnumerable’
Looks like I’m not completing the interface, but how do I implement it??
I had hoped to have them nested so that I could show the Member and the equipment they use.
Hopefully this is clear enough.
Thanks in advance!