Does C# do tail recursion? [duplicate] - c#

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Why doesn't .net/C# eliminate tail recursion?
Does C# do tail recusion?
I can't find any documentation telling me if it does or not.

C# does not innately support tail recursion in the language but here is an interesting article on a similar technique call trampolining that may help you in your situation

Unfortunately, it does not, at least not yet.
I'm not sure if the standard itself specifies anything about (dis)allowing tail recursion. Regardless, since .Net supports tail recursion, so it would be nice for this to make its way into C#.
If you really need tail recursion in a .Net language, consider F# as an alternative.

Related

What's the principal advantages of C# over VB.net? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicates:
What are the most important functional differences between C# and VB.NET?
C#'s edge over VB
I'm programming in VB.net because I'd former experience in VB 6.0 and I've familiar with its syntax. I know that C# is preferred by the biggest part of .net programmers. I know that C performance had superior performance against many other languages, but there is a good advantage in the same .net framework? There is a quite good reason for advicing me if should I migrate right now from VB to C#? Thanks!
Wikipedia has a good comparison of the two.
Personally, I chose to learn C# because I find the VB syntax too verbose, and the wages were higher. I think there's sometimes an (unjustified?) stigma attached to VB.NET that it's a 'lesser' language, and that can sometimes be reflected in the attitudes of employers and subsequently the remuneration on offer.
At the end of the day though, the output you get from either language is the same.
I'd advise you to program in the language you are comfortable with. There are minor differences in the languages (C# has some syntactic features that vb.net doesn't and vice versa), but eventually, they compile to the same ILCode and thus perform the same.

Learning Java from a C# background [duplicate]

This question already has answers here:
What are major differences between C# and Java?
(7 answers)
Closed 8 years ago.
For complicated reasons (not C#'s fault I love that language very much) I have to learn Java. I hate learning new langages and i dont wanna have to learn what I already know from C#.
What are some resources that teach whats different without learning it all?
I realize this isn't a very specific answer, but the best advice I can give you is to not go into it with the "I hate learning new languages" mindset. If you're familiar with C#, Java will be a piece of cake. Depending on what you're working on, most of your questions can easily be answered by a quick look at the API documentation. I don't think you have to worry about "learning it all".
The problem won't be the syntax but the framework. Since I'm not a Java developer either, I'm not sure where to look. But I suggest looking into the frameworks you'll be working with instead of syntax.

Effective C# tips [duplicate]

This question already has answers here:
Closed 13 years ago.
Possible Duplicates:
Is there a site that emails out daily C# tips and tricks?
What are your C# Commandments?
A little background:
I have skimmed through Effective C# by Bill Wagner. I know that my opinion on a book like that is too insignificant. But, still just for record I plan to read and re-read the books for years to come. It is just too good.
Now the question: Can SO C# gurus tell me their favorite C# tip(s) to make their code effective.
EDIT:
I looking for something that C# gurus use in their day-to-day coding to make it effective. I am not looking for hidden features of C#. If this has already been answered let me know. Thanks.
We have a simialr questions :
Hidden Features of C#
Is there a site that emails out daily C# tips and tricks?
No fancy tricks, just clear well documented code, because in the end you will have to come back to it at 3am in the morning and curse the bug that your cleverness created.
Measure, optimize and measure to make sure you did optimize it.
Also, the compiler and garbage collector usually are smarter than you are. Let them do their jobs.
Without question, LINQ is one of the most powerful tools available, and the C# integration is superb. It changes how you think about shaping and processing data in a strongly-typed language. I highly recommend becoming proficient in this area.
There are also many cases where the compiler supports syntactic sugar for common patterns, such as automatic properties, the using, foreach, and yield return statements, type inference, lambda expressions, extension methods, object and collection initializers, etc. The list goes on and on. Learning these features and the patterns behind them can drastically reduce the amount of code needed to express particular concepts.

Java tutorial for C# developer [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Best way to really grok Java for a C# guy
I worked on C# for a few years now move to Java. Is there a good Java tutorial for C# developers?
thanks!
Here is a helpful article to compare the language syntax and some differences between the two.
as far as i know java has a similar syntax ;
anyway have a look here this article compare c# and java keywords
This book isn't geared specifically towards people coming from a C# background, but I still recommend it highly. You'll draw the comparisons with C# on your own as you read. And it is free in electronic form. Bruce Eckel's "Thinking In Java"

Interview question on C# and VB.net similarities/differences [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
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.
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.
What would be a good response to an interviewer when they tell me they are looking for a C# developer - or similar questions?
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:
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.
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).
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.
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.
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
I love C# to death, but I envy VB.NET's optional parameters. Office automation in C# is so very, very painful.
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.
#DAC - VB now (in .net3.5) has support for 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).
I'm also a C# feller to the death but the differences are not just syntax. There are places where VB wins HANDS down
Optional parameters
Late binding
Working with COM from C# can be a very frustrating affair. (Which is not to say impossible!)
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.
I'd also recommend you learn the C# syntax ASAP. If you're experienced with VB and Java it won't take long.
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 or C# both are syntax only diffrent but if you are applying way of logic is same.

Categories