当您.NET处理一切时,为什么要学习winAPI [英] Why learn winAPI when you .NET takes care of everything

查看:75
本文介绍了当您.NET处理一切时,为什么要学习winAPI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道为什么当.NET几乎可以处理所有事情时,为什么现在要学习win API?

我的意思是编码要简单得多.我只是想知道我是否应该麻烦学习win API?

I was just wondering why one would learn win API now when .NET pretty much takes care of everything?

I mean the coding is a lot less complex. I was just wondering if I should bother learning win API?

推荐答案

1.因为它不(照顾一切).

2.因为Win32 API位于内核和任何框架之间,包括.NET.
1. Because it doesn''t (take care of everything).

2. Because the Win32 API sits between the kernel and any framework, including .NET.


1.因为在某些情况下托管内存环境不适合(并且.net是托管的)

2.因为在某些情况下您必须针对许多不同的平台(并且WinAPI与X-windows相似,而MAC本机API ...,.net却是不同的野兽)

3.因为-对于基础API而言,.net效率低下且非常膨胀.
1. Because there can be context where managed memory environments aren''t suitable (and .net is managed)

2. Because there are context where you have to target many different platform (and WinAPI are similar to X-windows as to MAC native API ..., .net is all a different beast)

3. Because - respect to the underlying API, .net is inefficient and extremely bloated.


学习或不学习任何东西完全是您的选择.是的,您可以成功开发.NET代码,而无需使用Win32 API…直到遇到无法用.NET解决的问题.

请记住:每次使用P/Invoke从.NET代码访问Win32 API时,都会失去可移植性.由于这不是移植性限制的唯一来源,因此使用P/Invoke可能会或可能不是一个明智的选择.

即使在这种情况下,您也可以选择.在某些情况下,完全可以放弃一些额外的功能:并不是那么关键,牺牲可移植性并不是明智的选择(尤其是目前所有代码都是纯.NET).在其他情况下,您可以将这个问题留给您的同事:并非每个人都享有万事通"的美誉.

还请记住:Microsoft计划迟早放弃Windows,并转移到不使用Windows API或使用其旧版工具的系统;新系统就位于硬件抽象层上.已经创建了一个这样的系统,称为奇点系统,请参阅 http://en.wikipedia.org/wiki/Singularity_(operating_system) [ ^ ],其他系统正在开发中开发,请参见> http://en.wikipedia.org/wiki/Midori_(operating_system) [ ^ ], ^ ].我知道几个基于CLI标准的开源OS项目: http://en.wikipedia.org/wiki/Cosmos_(操作系统) [ ^ ], http://en.wikipedia.org/wiki/SharpOS_(operating_system) [
Learning or not learning anything is entirely your choice. Yes, you can successfully develop .NET code without ever addressing to Win32 API… until you face with a problem not solvable with .NET.

Remember: every time you use P/Invoke to access Win32 API from .NET code, you loose your portability. As this is not the only source of portability limitation, using P/Invoke may or may not be a good decision.

Even in this case, you have some options. In some situation, it''s perfectly OK to give up some extra feature: it it is not so critical, maybe it is not wise to sacrifice portability (especially is at the moment all your code is pure .NET). In other situations, you can leave this problems to your colleagues: not every one can have a reputation of a "Jack of all trades".

Also remember: the Microsoft plan is to abandon Windows sooner or later and move to systems which does not have Windows API or anything using its legacy; the new systems sit right on the Hardware Abstraction Layer. One such system is already created, called Singularity, see http://en.wikipedia.org/wiki/Singularity_(operating_system)[^], other systems are being developed, see http://en.wikipedia.org/wiki/Midori_(operating_system)[^], http://en.wikipedia.org/wiki/Barrelfish[^]. I know couple of Open Source OS projects bases on CLI standard: http://en.wikipedia.org/wiki/Cosmos_(operating_system)[^], http://en.wikipedia.org/wiki/SharpOS_(operating_system)[^].

So, your extensive knowledge of Win32 API may get obsolete, while .NET knowledge is still actual. Maybe, the real value is in the theoretical background rather than technical information? You need to be educated to make educated investment in your working time.

—SA


这篇关于当您.NET处理一切时,为什么要学习winAPI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆