作为 VB.NET 程序员学习 C#

发布于 2024-08-17 17:48:02 字数 157 浏览 8 评论 0原文

我正在考虑切换到 C#。我有 C/C++ 背景,但 C# 对我来说有点不同。我切换主要是因为 Silverlight 和 MVVM;所有示例均采用 C# 语言。所有信息都是用 C# 编写的,当我通读所有信息时,我感到很困惑。

从现有的 C/C++ 知识开始学习 C# 的好地方是什么?

I am looking to switch to C#. I come from a C / C++ background but C# is a little different for me. I am switching mainly because of Silverlight and MVVM; all examples are in C#. Any information is in C# and I am confused when I read through it all.

What is a good place to start learning C# when starting with existing C / C++ knowledge?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

尝蛊 2024-08-24 17:48:02

尽快开始用 C# 编写代码。学习语言的唯一方法就是写它。您已经了解 VB.NET。对于 .NET 新手来说,您已经领先了很多。

将您用 VB.NET 编写的小型应用程序有条不紊地将其更改为 C#。

您将很快学会语法等。

用 C# 编写您未来的所有项目。只要强迫自己做出改变,你就会做得很好。

Start writing code in C# ASAP. Only way to learn the language is to write it. You already understand VB.NET. You've got a huge lead on anyone new to .NET.

Take a smallish application you've written in VB.NET and methodically change it over to C#.

You'll learn the syntax, etc. quickly.

Write all of your future projects in C#. Just force yourself into the change and you'll do fine.

秋日私语 2024-08-24 17:48:02

阅读最佳 C# 书籍。 :)

Read the best C# books. :)

樱花细雨 2024-08-24 17:48:02

维基百科文章“C Sharp(编程语言)”是对C# 作为一种语言。

The Wikipedia article "C Sharp (programming language)" is a decent introduction to C# as a language.

筱武穆 2024-08-24 17:48:02

学习 VB.NET 后不久,我决定更愿意编写 C# 代码。我通过阅读几本书和参与一个项目来学习它。慢慢地,我也让我的同事从 VB.NET 转向了该语言。这些语言非常相似,一些代码转换只是改变语法的问题。

然而,如果您曾经与真正的 VB 用户一起工作过,您会看到他们的代码中使用的 VB 特定函数会让您摸不着头脑。例如,您必须转换字符串处理函数和转换函数。另外,C# 没有 RaiseEvent。在 C# 中,事件需要花费更多的精力来理解,因为您需要将注意力集中在委托(C++ 函数指针/回调)上。正如其他人所说,如果您来自 C++,这应该不会太困难。

许多人一直认为需要完成一个项目才能理解一门语言,我同意这一点。然而,如果您不拿起几本书并阅读有关语言的某些功能,您将永远不会了解它们。通过阅读几本书,我已经能够向我的同事展示许多有用的技术。

最后,C# 是一门很棒的语言。当我第一次开始使用 .NET 时,我非常怀疑,但现在我知道 MS 为该框架和语言聚集了合适的人才。

祝你好运。

Shortly after learning VB.NET I decided I'd rather be coding C#. I learned it by reading a couple of books and working on a project. Slowly, I got my coworkers converted over to the language from VB.NET as well. The languages are very similar, some code conversion is just a matter of changing syntax.

However, if you've ever worked with a true VB'er you will see VB specific functions used in their code that'll make you scratch your head. There are string handling functions and casting functions for example that you will have to convert. Also, C# has no RaiseEvent. Events take a little more effort to understand in C# because you need to wrap your mind around delegates (C++ function pointers/callbacks). As others have said, if you are coming from C++ this shouldn't be too difficult.

Many people go on about needing to work on a project to understand a language, which I agree with. However, there are features of languages which you will never know about if you don't pick up a couple of books and read about them. I've been able to show my coworkers many useful techniques just by reading a couple of books.

Lastly, C# is a great language. I was very skeptical when I first started using .NET, but now I know that MS got the right talent together for that framework and language.

Good luck.

两个我 2024-08-24 17:48:02

正如您了解 C++(如您在问题中所写)和 VB.Net(如您在标题中提到的)一样,如果您对它们都了解的话,C# 对您来说并不困难。如果是这种情况,只需获取 C# 中的任何源代码,然后读它。

顺便说一句,来自维基百科的文章是一个非常好的介绍。

As you know C++ (as you wrote in the question) and VB.Net (as you mentioned in the title), C# won't be hard for you if do know them both well. If this is the case, just grab any source in C#, and read it.

By the way, the article from wikipedia is a very nice intro.

瑾夏年华 2024-08-24 17:48:02

可能对您有用的一件事是使用转换器

  1. 在 VB 中编写您想要的代码。
  2. 将您不知道如何用 C# 编写的小段代码粘贴到 http://converter.telerik.com/< /a> 并转换。
  3. 将结果手动输入到您的 C# 项目中。

随着您对语言越来越熟悉,逐渐减少对转换器的依赖。

这足以让您入门,但是 C# 具有 VB 没有的语言功能,或者 VB 提供的方式过于冗长以至于没有人真正使用它。

当您查看网络上的代码示例(例如堆栈溢出)时,您会遇到更多功能,并且您需要手动查找语法或函数,或者从 C# 转换回 vb 以了解它在做什么(使用相同的转换器)。或者,只需将其粘贴进去,看看它会做什么。

One thing that may work for you is to use a converter

  1. Write your desired code in VB.
  2. Paste small pieces of code you don't know how to write in C# into http://converter.telerik.com/ and convert.
  3. Manually type the result into your C# project.

Gradually, reduce your reliance on converter as you become more familiar with language.

That is enough to get you started, however C# has language features that VB does not, or VB offers in a way that is so wordy that no one really uses it.

The more features you will come across as you look at code examples from around the web (like on stack overflow), and you need to either look up syntax or function manually, or convert from C# back to vb to understand what it is doing (use same converter). Or, just paste it in and see what it does.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文