I have a class that reads all information from file, line by line, into the array Equipment. I would like to pass Equipment to the setEquipment method, and copy them to the setEquipment array.
Screenshot with the mistake:
. What am I'm doing wrong?
string[] Equipment, Equipments;
public string[] InitialiseForm()
{
Equipment = File.ReadAllLines(@"C:\\Temp\\Equipment.txt");
Equipments = theEntity.setEquipment(Equipment);
return Equipments;
}
This is the method
public string[] setEquipment(params string[] newEquipments)
{
setEquipments = new string[newEquipments.Length];
newEquipments.CopyTo(setEquipments, 0);
return setEquipments;
}
setEquipment, you returnEquipmentsinstead ofsetEquipmentstheEntityis null in your screenshot. Where do you create anewinstance oftheEntity?@"..."(verbatim) string or use double (escaped) backslashes - you don't need both.