如何学习C#语言? [英] How to learn language C#?

查看:66
本文介绍了如何学习C#语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我所有的朋友!



我是新编码员。

我知道C和C ++。



我的朋友告诉我C#比C ++好。

所以我想知道如何学习C#?

Plz推荐一些书籍或网站给我。



我想知道C#和C ++之间有什么区别?

或者,何时使用C#?什么时候使用C ++?



BR!

非常感谢!

Hi,all my friends!

I am new coder.
I know C and C++.

My friend told me that C# was better than C++.
So i want to know how to learn C#?
Plz recommend some books or website to me.

And i want to know what's difference between C# and C++?
Or,when to use C#? when to use C++?

BR!
Thank you very much!

推荐答案

我认为更好是一个非常模糊的术语。如您所示,这取决于您需要做什么。我会说,更快速,更干净地开发多种类型的应用程序更容易。



如果你了解C ++,并做好OOP,你应该可以选择C#相对较快。然而,反过来可能并非如此。 C ++很难掌握并编写好的代码。说过我在C#中也看到了一些非常糟糕的代码。



有几个不同之处,我认为我不能在这里做正义。人们总是引用的那个是C#没有指针。嗯,是的,不。 C#使用对大多数对象的引用。如果你习惯于在C ++中使用引用,那么你就不会那么难以理解。但是,它们更像是指针,因为引用可以为null(默认情况下!),而在C ++中,您必须编写一些愚蠢的代码以使用空引用结束。



至于书籍,我所找到的最好和最有用的书籍,可能只有你需要的两本书: CLR通过C# [ ^ ]和有效的C# [ ^ ]。



这些天我个人会选择C#而不是C ++,除非它不是一个选项。实际上,在我的头脑中,这可能意味着必须恢复到C ++:

1)如果你正在编写一个你想在CLR / .NET所用的系统上使用的应用程序不可用。 (我不能快速了解在Windows以外的系统上实现它的进度如何)。

2)如果你正在编写一个需要被另一个非CLR调用的模块应用程序

3)如果您的模块或应用程序将与非CLR代码严重接口,并且开发类与其交互的开销(通过P / Invoke调用)将太大或过于复杂

4)可能还有其他原因(例如编写嵌入式代码?)但我无法想到一切;我相信其他人会评论告诉我一些我说过的错误:)



问候,

伊恩。
I think "better" is a very vague term. As you indicate it depends on what you need to do. I would say that it is easier to develop many types of applications more quickly and cleanly.

If you know C++, and do good OOP, you should be able to pick up C# relatively quickly. However, the converse is probably not true. C++ is harder to get to grips with, and to write good code. Having said that I have also seen some very bad code in C#.

There are several differences, which I don't think I could do justice here. The one that people always quote is that "C# has no pointers". Well, yes and no. C# uses references to most objects. If you're used to using references in C++ then it's not that difficult to get your head around. However, they are more like pointers in that a reference can be null (by default!) whereas in C++ you have to write some stupid code to end up with a null reference.

As to books, by far and away the best and most useful books I have found, and probably the only two you'll ever need are: CLR via C#[^] and Effective C#[^].

Personally these days I would choose C# over C++ unless it wasn't an option. Practically, off the top of my head, that probably means having to revert to C++:
1) if you're writing an application that you want to use on a system where the CLR/.NET isn't available. (I'm not up to speed with how progress of implementing it on systems other than Windows is going).
2) if you're writing a module that needs to be invoked by another non-CLR application
3) if your module or application will interface heavily with non-CLR code and the overhead of developing the classes to interact with it (through P/Invoke calls) would be too great or overly complicated
4) there may be other reasons (such as writing embedded code?) but I can't think of everything; I'm sure other people will comment to tell me something I've said is wrong :)

Regards,
Ian.


我认为你应该从Petzold的书开始。 Charles Petzold是十五本编程书籍的着名作家。对于许多人来说,他关于Windows编程的书籍是有关该主题的权威书籍。Microsoft Windows编程用C# [ ^对于希望使用C#编程语言和Windows窗体类库编写Windows应用程序的程序员来说,这是一个教程。 C#是一种基于C的面向对象编程语言,Windows Forms是Microsoft .NET框架的一部分。



C或C ++程序员需要知道什么关于C#和.NET Framework是一本关于.NET编程的好书,你可以从这个页面免费下载:

http://www.charlespetzold.com/dotnet/index.html [ ^ ]



在我看来,这是文章 对你来说也很有趣



祝你好运。

Alex。
I think you should start with Petzold's book. Charles Petzold is a well known author of over fifteen programming books. To many, his books on programming Windows are the definitive books on the subject."Programming Microsoft Windows with C#" [^] is a tutorial for programmers wishing to write applications for Windows using the C# programming language and the Windows Forms class library. C# is a object-oriented programming language based on C, and Windows Forms is part of the Microsoft .NET framework.

"What the C or C++ Programmer Needs to Know About C# and the .NET Framework " is a great book on .NET programming, that you can download free from this page :
http://www.charlespetzold.com/dotnet/index.html[^]

It seems to me, this article will be also interesting to you

Good luck.
Alex.


可以提到一些差异,例如:

C#是一种在虚拟机中运行的托管语言。它编译成平台无关的中间代码。

C ++创建直接在目标平台上运行的原始程序集。

因为C#在虚拟机中运行,所以处理内存管理自动。在C ++中,您必须手动处理内存,或者编写(或获取)垃圾收集库。但是,使C ++更容易使用(Auto Pointers和RAII)已经取得了很大进展。

C#不支持多重继承,C ++可以。

C#有委托,它是C ++函数指针和成员指针的强大替代品。

默认情况下,C ++不是托管的。 C#是。

C#有属性和事件的语法,所以更多的是一个永无止境的话题。

看看..

C ++和C#之间的区别 [ ^ ]



对于学习C#,请在 Google [ ^ ],你应该有吨链接,选择你喜欢的。

但我建议你 MSDN [ ^ ]。



祝你好运

Happy Coding
Shuvro
Some differences could be mentioned like:
C# is a managed language that runs in a virtual machine. It compiles down to a platform agnostic intermediate code.
C++ creates raw assemblies that run directly on the target platform.
Because C# runs in a virtual machine, memory management is handled automatically. In C++, you must handle memory manually, or write (or acquire) a garbage collection library. However, great strides have gone into making C++ a little easier to use (Auto Pointers, and RAII).
C# does not support multiple inheritance, C++ does.
C# has delegates, which are a powerful alternative to C++'s function pointers and pointers-to-members.
C++ is not, by default, managed. C# is.
C# has syntax for properties and events and so more what would be a never ending topic.
Have a look at..
Difference between C++ and C#[^]

For learning C# do a search in Google[^],you should have tons of links,choose what you like.
But i would suggest you to MSDN[^].

Good Luck
Happy Coding
Shuvro


这篇关于如何学习C#语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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