cannot assign void to an implicitly typed variable code example
Example: 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); });