What is difference between unsafe code and unmanaged code in C#?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
managed code runs under supervision of the CLR (Common Language Runtime). This is responsible for things like memory management and garbage collection.
So unmanaged simply runs outside of the context of the CLR. unsafe is kind of “in between” managed and unmanaged. unsafe still runs under the CLR, but it will let you access memory directly through pointers.