Yes you can create classes on the stack!
Read OriginalThis technical article demonstrates an unconventional C# method to create a reference type (class) instance on the stack using `stackalloc` and unsafe pointers. It details the code, benchmarks the performance against standard heap allocation, and discusses the significant limitations and impracticality of the approach for real-world use.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser