我確定這很簡單。我對 C# 不是很熟悉(我實際上是從 C++ 移植過來的)。單擊“確定”后,我正在調用 CalculateFrontages 類中的 CalculateLines 方法(片段): private void Button_Click(object sender, RoutedEventArgs e) { // MessageBox.Show("User clicked OK"); string value = MSTGapThresholdInMeters.Text; MSTGapValue = Int32.Parse(value); MainWindowViewModel.RedTLS = CalculateFrontages.CalculateLines(MainWindowViewModel.RedArmy, Map.MetersPerPixel, MSTGapValue); MainWindowViewModel.BlueTLS = CalculateFrontages.CalculateLines(MainWindowViewModel.BlueArmy, Map.MetersPerPixel, MSTGapValue); this.DialogResult = true; }這是我要調用的另一個類 CalculateFrontages 中的方法 CalculateLines(片段):namespace TacticalAILib{public class CalculateFrontages{ static int[] U; private static TacLineStruct CalculateLines(List<MATEUnit> Army, double MetersPerPixel, int MSTGapValue) { int TempFrom, TempTo; float TempWeight; int NumEdges = 0; double Threshold = MetersPerPixel * MSTGapValue; U = new int[Army.Count];它拋出了這個編譯器錯誤:錯誤 CS0426 類型名稱“CalculateLines”在類型“CalculateFrontages”中不存在我認為這是范圍錯誤或聲明錯誤。我只是對此了解不夠。
- 1 回答
- 0 關注
- 111 瀏覽
添加回答
舉報
0/150
提交
取消