C# for .NET 和 C# for mono 有什么真正的区别吗?
我正在考虑自学 C#,但我能找到的所有书籍都是基于官方 .NET 的。我是一名 Linux 用户,所以当然更愿意我的应用程序主要在 Mono 上运行(尽管 xplatform 到 .NET 也可以)。一本针对 .NET 上的 C# 的书对于 Mono 上的 C# 是否同样有用?
I was thinking about teaching myself C#, but all the books I can find are based around the official .NET. I'm a Linux user and so would of course rather my applications run primarily on Mono (although xplatform to .NET would be fine). Would a book geared towards C# on .NET be just as useful for C# on Mono?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除了小错误和不完全相同的极端情况 Mono 非常严格地遵循 C# 规范,任何有关 C# 语言的书籍都可以毫无问题地应用。
主要区别在于类库,其中某些部分并不总是在 Mono 中实现,而其他部分则不应该使用。
例如 Mono 中不存在的 WPF(用户界面库)或存在的 WinForms(旧的用户界面库),但在 Linux 下您应该使用 GTK# 来代替。
所以你应该看看你的书到底讲了什么,然后根据功能来选择。一些非常糟糕的书从如何使用 Visual Studio 并输入你的第一个 WPF hello world 开始,它们显然是你作为 C# Linux 程序员不想要的。
虽然 mono 项目包含良好的文档,但查找是否支持某些类的好方法是浏览 https://github.com/mono/mono/tree/master/mcs/class 如果命名空间不存在或者充满了抛出 NotSupportedException 的类,那么您就知道不能使用它。
如果我推荐一本书,那就是Mono:开发人员笔记本,它已经针对人们了编程并想使用 mono 学习 C#。
Except from small bugs & corner cases that aren't exactly the same Mono follow the C# specification pretty closely and any book about the C# language would apply without problem.
The main differences are in the class library where some parts aren't always implemented in Mono and other parts that are but that you shouldn't use.
Examples are things like WPF (An user interface library) that doesn't exists in Mono or WinForms (The old user interface library) that exists but under linux you should use GTK# instead.
So you should see what your book speak about exactly and choose in function. Some very bad books begin with how to use visual studio and type your first WPF hello world, they are clearly what you don't want as a C# linux programmer.
While the mono project contains good documentation a good way to find if some class is supported is to browse the source on https://github.com/mono/mono/tree/master/mcs/class and if the namespace is either not there or filled with classes throwing NotSupportedException, you know that you can't use it.
If i would recommend a book it would be Mono: A Developer's Notebook it's aimed at people already programming and wanting to learn C# with mono.
任何 C#/.Net 书籍的绝大多数内容都适用于其他平台上的 Mono/C#。它们都实现相同的规范。 Mono Develop 在其他平台上也是一个不错的选择。
当然,库中任何特定于平台的内容都会有所不同。例如:
以下是有关该主题的相关线程:
.NET csc 和 Mono mcs 的兼容性
The vast majority of any C#/.Net book would apply to Mono/C# on other platforms. They both implement the same spec. Mono Develop is also a good option on other platforms.
Of course anything platform specific in the libraries would be different. For example:
Here's a related thread on the topic:
Compatibility of .NET csc and Mono mcs