when I said slow, I meant generating an array of ints in C# passing it to R through the wrapper, perform whatever calculation you desire and return its results. You will find the time it takes till the result comes back is almost entirely taken up by passing the array into R. The library is very poorly written. I would never have done it that way but would have passed the data through an inmem db, such as Redis or the like.
I'm looking at gretl right now. In addition to having a GUI front end and scripting, gretl also has a separate C library of functions that the GUI and scripting uses. The C library is particularly interesting and relevant to the thread. Among the many analysis functions is the Johansen cointegration test. C library functions can be easily called from C#. There are about a dozen mentions of gretl on ET.
I did this last year, I initially used R (D)COM Interface to call R. However once I looked into R language I realised that it could do everything C# could do using packages. So I ended up writing it in R completely on a ubuntu box (using urca package). It's always better to reuse code written by experts than try and implementing it yourself.
I recently got the Johansen cointegration test working in C++ if anyone cares. It's a port of the C# code posted by Vanna over at quantcode. https://github.com/stevegee58/JohansenCointegration