Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我看到这里使用了相当多的术语托管和非托管。在线搜索我可以对它们有一个模糊的概念,但我真正需要知道的是它如何影响我作为 C# 桌面应用程序开发人员?我怎么知道我在任何时候都在处理什么,以及它如何改变我对该代码的处理方式?
什么是 C# 中的托管/非托管代码?
托管代码是需要 .NET 框架才能运行的代码……非托管代码不需要。如果您使用 C# 编写代码,那么您正在编写托管代码。如果您使用 Pinvoke,您可能会与非托管代码交互,但如果您坚持使用纯 C#,您的应用程序将是所有托管代码。