enter image description here Screen bend

Actually, DXMenuItem has a constructor with string parameters, void. So he doesn’t like how I call the Count function with parameters. Cannot convert the type. How can I properly call a function with parameters?

  • one
    you do not show method signatures, constructor signatures, or anything at all, and why are you doing - what answer are you waiting for? Try to answer the question yourself. я вызываю foo(bar()) но не работает, как исправить? - tym32167 pm
  • It was not correct on my part. I added the description of the method. In principle, by code everything is clear what I want to do. - Kama
  • 1) Please attach the code text, not pictures. 2) Give a minimal example to reproduce the problem, since after your update it is still not clear where the problem is. What type of DXMenuItem is it and what is its signature? - tym32167

2 answers 2

The DxMenuItem constructor DxMenuItem only two overloads with two parameters:

 DXMenuItem(string caption, DXMenuItemPriority priority) DXMenuItem(string caption, EventHandler click) 

Most likely there was a second overload of the receiving click handler.

In this case, you can really pass lambda

 new DxMenuItem(str, (s,e)=> Count(...)) 
  • Yes, that's right. Apparently you are familiar with DevExpress. Thank you very much! I did not understand how to implement this technically. - Kama

The point is in the expected types of parameters for the DXMenuItem constructor. It is unlikely that the type of the second parameter is void (.

Actually, the DXMenuItem delegate has a constructor with string, void parameters.

It is also unlikely that the DXMenuItem type is a delegate. It seems that in the quoted phrase you are trying to describe the method signature: the parameter is string , the return value is void .

  • one
    well you, the gnomes tell you, but I’m not at all aware of what the author has the problem, but definitely with the types of parameters - tym32167
  • I immediately realized that it was not void. The fact is that I don’t understand how to call Count with the void return type at the same time passing parameters. - Kama