Answers for "cannot assign void to an implicitly typed variable"

C#
0

cannot assign void to an implicitly typed variable

Foreach returns void that is why you are getting the error. 
Your statement on the right hand side of assignment is not returning anything. 
You can do the same in two statements like:

var v = new List<Form1>() { this };
v.ForEach(x => { x.GetType().Name.Contains(typeof(Button).Name); });
Posted by: Guest on June-07-2021

Code answers related to "cannot assign void to an implicitly typed variable"

C# Answers by Framework

Browse Popular Code Answers by Language