Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Func not returning anything?

Tags:

c#

lambda

This may sound like a bit of a dumb question but how do I make a Func<> variable that doesn't return anything?

like image 274
RCIX Avatar asked Jun 10 '09 05:06

RCIX


2 Answers

You can use Action<T> for a delegate that takes a variable and returns void.

But note that you can also just declare your own delegate types if you want to. Action<T>, for example, is just

public delegate void Action<T>(T obj)
like image 185
Gabe Moothart Avatar answered Oct 26 '22 16:10

Gabe Moothart


Will the Action<T> delegate work for you?

Action<T>

like image 31
Jon Sagara Avatar answered Oct 26 '22 14:10

Jon Sagara