This is really a .NET question, but I am wondering what the answer is. I've read before that closures are compiled to .NET classes under the hood.
Generally it would depend on the implementation, but I would be surprised to learn that this part would not be optimized in VS2015.
Edit: This question is not a duplicate because it is not asking what a closure is, but about a implementation detail about them.
Edit2:
let math_func a =
let mutable a = a
let add b = a <- a + b
let mult b = a <- a * b
let div b = a <- a / b
let ret () = a
add, mult, div, ret
let add, mult, div, ret = math_func 5
add 5
ret()
mult 4
ret()
div 2
ret()
Here is a shortish F# example, with all the functions enclosing the same variable. I can think of more complex examples, but the ones I am using in a game project instead of virtual functions are not much more complicated.
I've never really realized how much they can replace with regards to object oriented programming and I am wondering how far I can go with this. They are also neat as they allow me to defer thinking about how to exactly design my program.