Code Fix

初級 › No overload for method の原因と直し方 › パターン5

No overload for method の原因と直し方

メソッドの引数の数や型が定義と一致しないときに出ます。

 1  class Program {
 2      static double Avg(double a, double b, double c) { return (a + b + c) / 3; }
 3      static void Main(string[] args) {
 4          System.Console.WriteLine(Avg(1, 2______));
                                                ^
 5      }
 6  }
Program.cs(4,34): error CS7036: There is no argument given that corresponds to the required parameter 'c' of 'Program.Avg(double, double, double)'

空欄を埋めてビルドを通す

広告
広告スロット(未設定)

No overload for method の原因と直し方

オーバーロード解決の仕組みを理解する入り口になります。

このエラーの解説と類題をまとめて見る →

広告
広告スロット(未設定)