Basically the only performance issue you need to know about in C # that is different from what you should know in C ++ is the garbage collector. Just do not allocate memory during the main game cycle, and everything will be fine. Here is a blog post that goes into detail .
Now for your questions:
1) If the frame collection iterator can be implemented as a value type (without creating garbage), then it usually (always?) Was. You can safely use foreach , for example List<> .
You can check if you are assigned in your main loop using the CLR Profiler .
2) Use List instead of arrays. They will handle resizing for you. You must use the Capacity property to Capacity enough space before starting gameplay to avoid problems with the GC. Using arrays, you just need to implement all these functions yourself - ugly!
GC starts at distribution (but not at freeing up memory). On the Xbox 360, it runs for every 1 MB allocated and is very slow. On Windows, this is a bit more complicated, but also does not have such a huge impact on performance.
3) C # delegates are pretty damn fast. And faster than most people expect. They roughly coincide with method calls on interfaces. Here and here are questions that provide more comments about delegate performance in C #.
I could not say how they compare with C ++ parameters. You have to measure it.
4) No. I am sure that this code will produce an identical IL. You can parse it and check, or profile, though.
I can add - without testing myself - I suspect that having event myDelegate will be slower than normal myDelegate if you don't need all the magic of event .
source share