Closed kostya9 closed 1 year ago
Hehe, I guess you can tell by my code that I've mostly been working with older .NET framework versions. Will also update my other projects with what I am learning here from your changes, thanks for your contribution!
I didn't know about UTF-8 string constants at all, that makes both the code easier to read and of course saves some resources when the byte arrays don't have to be created dynamically at runtime again and again.
I did know about Tasks/TPL but somehow it still isn't the first thing that comes to my mind when I want to run something in a separate thread. Also I was a bit unsure whether it's a good idea to use such a high level function here, since eventually code will often synchronize to OBS C++ threads using obs_enter_graphics(). However, I just tried in my new async image source plugin and it's working fine so I guess we're good.
You're right about the fixed statement, it doesn't make sense to use on something that is returned for later use by unmanaged code (because this will happen after we already left the "fixed" context). Maybe we should include some example where GC.AllocateArray() is used for a situation like this instead.