c# - Unsafe code and fixed statements with StringBuilder -


I was thinking about how to pass a string or StringBuilder to the C function which outputs the string by the parameter . I have received a great answer in

but I doubt nobody can explain to me that the garbage collector does not move the stringbilder instance (Managed) during imported function execution ?

How the string and string builder are used when using the COM and P / Invoke See for This obviously why usage patterns is not secure, but indicates that the use of string and stringbilders for P / A is supported and desired behavior. I suspect that the Marshalling system takes care to pin the buffer for the duration of the external call, prevents GC from transferring it.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -