LoginSignup
0
0

More than 1 year has passed since last update.

「cannot assign method group to an implicitly-typed variable」のエラーが出た

Posted at

C#の学習をしているときに、

var data10 = Enumerable.Repeat(1, 10).ToList;

という書き方をすると、エラーが出てしまった。

cannot assign method group to an implicitly-typed variable

というものだった。

解決策

ToListがメソッドなので、「ToList()」と書かないといけないので、これを直したた解決。

var data10 = Enumerable.Repeat(1, 10).ToList();

今回発生したエラーは返す型が指定されているのに、nullを返すことが分かっていると発生するエラーみたいだ。

参考記事

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0