The question is simple. Is there a keyword equivalent to Call
of Visual Basic .NET in C #?
In Visual Basic, I called a method of a class without explicitly declaring a member for it:
Call New Form() With {.Text = "Olá, mundo!"}.ShowDialog()
This all above would be the equivalent of this in C #:
Form tmp = new Form() { Text = "Olá, mundo!" };
tmp.ShowDialog();
tmp.Dispose();
I find this keyword very useful because it saves space on code, organization, and memory management by discarding used objects after the end of use.
Is there any way to call a member, lambda , or procedure that Call
does, but in C #?