This may sound like a bit of a dumb question but how do I make a Func<>
variable that doesn't return anything?
Asked
Active
Viewed 1,956 times
3 Answers
14
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)

Gabe Moothart
- 31,211
- 14
- 77
- 99
-
I don't know but is it necesary to usea delegate will the purpose not solved by only making the return type as void – Meetu Choudhary Jun 10 '09 at 05:37
-
You can't specify void (or Void) as a type argument. – Jon Skeet Jun 10 '09 at 05:41
-
but the question is about return type not for the agruments – Meetu Choudhary Jun 10 '09 at 05:49