关于 C# 和 VB.net 异同的面试问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14775/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Interview question on C# and VB.net similarities/differences
提问by wusher
I have been a VB.net developer for a few years now but I am currently applying to a few companies that use C#. I have even been told that at least one of the companies doesn't want VB.net developers.
我已经成为 VB.net 开发人员几年了,但我目前正在申请一些使用 C# 的公司。我什至被告知至少有一家公司不想要 VB.net 开发人员。
I have been looking online trying to find real differences between the two and have asked on crackoverflow. The only major differences are a few syntax difference which are trivial to me because I am also a Java developer.
我一直在网上寻找,试图找到两者之间的真正区别,并询问了crackoverflow。唯一的主要区别是一些对我来说微不足道的语法差异,因为我也是一名 Java 开发人员。
What would be a good response to an interviewer when they tell me they are looking for a C# developer - or similar questions?
当面试官告诉我他们正在寻找 C# 开发人员或类似问题时,对他们的良好回应是什么?
采纳答案by akmad
I've had to interview people for a few C# positions and this is my general advice for VB.Net developers interviewing for a C# position:
我不得不面试一些 C# 职位的人,这是我对 VB.Net 开发人员面试 C# 职位的一般建议:
- Make sure you are clear that you have been working VB.Net. This seems obvious but is something that apparently isn't (in my experience).
- Try to give a code sample, if possible. I've seen some horrible VB.Net (and C#) written by VB programmers who didn't seem to learn much in the transition to .Net.
- Be able to write in C# during the interview, if asked. I know there aren't many real differences between the two, but I don't want to pay you to learn the new syntax.
- 确保您清楚您一直在使用 VB.Net。这似乎很明显,但显然不是(根据我的经验)。
- 如果可能,请尝试提供代码示例。我见过一些由 VB 程序员编写的可怕的 VB.Net(和 C#),他们在过渡到 .Net 的过程中似乎没有学到很多东西。
- 如果被问到,能够在面试期间用 C# 编写。我知道两者之间没有太多真正的区别,但我不想付钱让您学习新语法。
For your specific question: I've asked that type of question before and what I wanted to hear about was how the underlying system and framework were the same. If possible, talk about garbage collection, IDisposable, finalizers, the dangers of unsafe code blocks, stack vs heap, etc. All the kind of stuff to show that you really understand the intricacies of the .Net framework. Right or wrong, the heritage of VB brings with it an expectation of a lack of understand of lower level programming and windows in general (which, ironically enough, a c++ developer would have of a c# developer... and so on).
对于您的具体问题:我以前问过这种类型的问题,我想知道的是底层系统和框架是如何相同的。如果可能的话,谈谈垃圾收集、IDisposable、终结器、不安全代码块的危险、堆栈与堆等。所有这些都表明你真正了解 .Net 框架的复杂性。不管是对是错,VB 的传统带来了对低级编程和一般窗口缺乏理解的期望(具有讽刺意味的是,c++ 开发人员对 ac# 开发人员......等等)。
Lastly, how you frame your experience can make a world of difference. If you position yourself as a .Net developer, rather than VB.Net or C#, the stupid, pseudo-religious, banter may not enter the conversation. This of course requires that you actually know both VB.Net and C# at the time of the interview, but that's a good policy regardless.
最后,你如何构建你的体验可以让世界变得不同。如果您将自己定位为 .Net 开发人员,而不是 VB.Net 或 C#,那么愚蠢的、伪宗教的、玩笑可能不会进入对话。这当然要求您在面试时实际了解 VB.Net 和 C#,但无论如何这是一个很好的策略。
The truth of the matter is that if you find that the person interviewing you writes you off simply because you've previously been developing in VB.Net, it's likely not going to be a place you want to work at anyway.
事情的真相是,如果你发现面试你的人仅仅因为你以前一直在 VB.Net 中开发而将你拒之门外,那么它无论如何都不会是你想要工作的地方。
回答by Andrew Taylor
I think the truth will-out on this:
我认为真相将在这一点上揭晓:
I'm a software developer, the syntax of the language is the final part of the puzzle. By employing me, you're getting someone with demonstrable experience of problem solving and logic. I'm experienced with the .NET environment, the CLR and the associated Windows stack, including SQL and Windows server. I don't know the C# syntax, but, I am used to object-oriented approach, I will have no problem getting totally up to speed on the finer points of the syntax within a couple of weeks. You can see from these examples of my code that I'm an experienced developer, I assure you the transition will be seamless. I have already made a start learning the language, I haven't had any problems so far.
我是一名软件开发人员,语言的语法是拼图的最后一部分。通过雇用我,你会得到一个在解决问题和逻辑方面具有明显经验的人。我对 .NET 环境、CLR 和相关的 Windows 堆栈(包括 SQL 和 Windows 服务器)有经验。我不知道 C# 语法,但是,我习惯于面向对象的方法,在几周内完全掌握语法的精髓是没有问题的。您可以从我的代码示例中看出我是一名经验丰富的开发人员,我向您保证过渡将是无缝的。我已经开始学习这门语言了,到目前为止我还没有遇到任何问题。
回答by DAC
Some differences (that are more substantial than syntactical) that suitably catch me out sometimes:
一些差异(比语法更重要)有时会适得其反:
- VB.NET does not have anonymous delegates
- Unsafe code blocks aren't in VB.NET
- VB.NET 没有匿名委托
- 不安全的代码块不在 VB.NET 中
回答by Reto Meier
Truthfully? If you're a Java developer too, I'd lead with that. A Java developer with some experience in .NET will generally make a better impression than a VB developer with experience with Java. If you can answer questions on the difference between .NET and Java you should be in good shape.
说实话?如果您也是一名 Java 开发人员,我会引导您。具有一些 .NET 经验的 Java 开发人员通常会比具有 Java 经验的 VB 开发人员留下更好的印象。如果您能回答有关 .NET 和 Java 之间区别的问题,那么您应该处于良好状态。
I'd also recommend you learn the C# syntax ASAP. If you're experienced with VB and Java it won't take long.
我还建议您尽快学习 C# 语法。如果您对 VB 和 Java 有经验,那不会花很长时间。
A lot of developers have issues with VB and the people that use it. Valid or not you'll have to deal with that reality.
许多开发人员对 VB 和使用它的人都有疑问。无论有效与否,您都必须面对现实。
回答by Stu
I love C# to death, but I envy VB.NET's optional parameters. Office automation in C# is so very, very painful.
我爱死 C#,但我羡慕 VB.NET 的可选参数。C# 中的办公自动化非常非常痛苦。
回答by Keith
@DAC - VB now (in .net3.5) has support for lambdas:
@DAC - VB 现在(在 .net3.5 中)支持 lambdas:
Function(x) x.ToString()
In an interview I'd say that understanding the CLR and what the code's really doing is what's important, and that you're happy to code in either (assuming that you are).
在一次采访中,我会说理解 CLR 和代码真正在做什么很重要,并且您很乐意在其中任何一个中编码(假设您是)。
回答by akmad
VB or C# both are syntax only diffrent but if you are applying way of logic is same.
VB 或 C# 都只是语法不同,但如果您应用逻辑方式是相同的。
回答by Rad
I'm also a C# feller to the death but the differences are not just syntax. There are places where VB wins HANDS down
我也是 C# 的死神,但差异不仅仅是语法。有些地方VB赢了HANDS down
- Optional parameters
- Late binding
- 可选参数
- 后期绑定
Working with COM from C# can be a very frustrating affair. (Which is not to say impossible!)
从 C# 使用 COM 可能是一件非常令人沮丧的事情。(这并不是说不可能!)