I\'m trying to create a function that can create an Action that increments whatever integer is passed in. However my first attempt is giving me an error \"cannot use ref or
This is not possible.
The compiler will transform all local variables and parameters used by anonymous methods into fields in an automatically generated closure class.
The CLR does not allow ref types to be stored in fields.
For example, if you pass a value type in a local variable as such a ref parameter, the value's lifetime would extend beyond its stack frame.