我有一个类,它将所有信息从文件中逐行读入数组Equipment
。我想将Equipment
传递给setEquipment
方法,然后将它们复制到setEquipment
数组中。
有错误的屏幕截图: 。我做错了什么?
string[] Equipment, Equipments;
public string[] InitialiseForm()
{
Equipment = File.ReadAllLines(@"C:\\Temp\\Equipment.txt");
Equipments = theEntity.setEquipment(Equipment);
return Equipments;
}
这是方法
public string[] setEquipment(params string[] newEquipments)
{
setEquipments = new string[newEquipments.Length];
newEquipments.CopyTo(setEquipments, 0);
return setEquipments;
}
答案 0 :(得分:1)
在屏幕截图中,n is 5
the first item of head_data is ('A', [-0.005364798, -0.022912843, 0.017346957])
tail data item: [-2.022841336, -1.477407454, -5.606136767]
tail data item: [2.521789668, 2.88925177, 2.572440406]
tail data item: [-0.401914888, -0.722582908, 0.244151982]
tail data item: [0.806040926, -0.990697574, 1.474733506]
tail data item: [-0.903074369, 0.301436166, 1.314862295]
n is 7
the first item of head_data is ('A', [-0.591644968, -0.645755982, -0.014245979])
tail data item: [1.649465696, -2.945456091, -0.152209323]
tail data item: [0.531241391, -1.113956273, -0.135548573]
tail data item: [-0.529287352, -0.556746737, -0.061346528]
tail data item: [-2.152476371, 6.326868481, 0.441458459]
tail data item: [-1.633473432, 3.325310912, 0.291306019]
tail data item: [0.726490986, -8.268565793, -0.51257518]
tail data item: [1.408090505, 3.232545501, 0.128915126]
为theEntity
。请记住在调用其方法之前创建实体的实例。