Reasons Why Visual Basic is Better Than C#Visual Basic is a better programming language than Visual C#. Here are 1. 0 reasons why you should always choose VB over C#. Rose is a rose is a rose is a rose” This is a quotation from Gertrude Stein’s 1. Geography and Plays. However, the poetry wouldn’t work in C#, because – unforgivably – it’s a c. ASe- Se. NSit. Iv. E language. Before I start ranting, let me just acknowledge that case- sensitivity confers one (and only one) advantage – it makes it easier to name private and public properties: Writing properties like this means that you can refer to the public Name property, and it’s obvious what the private equivalent will be called (name).//privateversionofvariableprivatestringname=null; publicstring. Name. You keep having to switch between upper and lower case when typing, causing RSI in your poor little fingers as you reach for the inconsiderately located Shift key. You are much more likely to make mistakes – are you sure you meant to type Date. Of. Birth, or should it have been dateofbirth? When you accidentally leave Caps lock on, it really matters. The only possible benefit is that you can use more combinations of variable names, that is, you can use more of one of the few infinite resources in this universe! The Switch clause Both VB and C# contain a way of testing mutually exclusive possibilities, the Select Case and Switch clauses respectively. Only one of them works properly. A Visual Basic Select Case clause, returning a description of how old someone is. The age range for a young person is a tad generous, reflecting the age of the author of this article. A Visual Basic Select Case clause, returning a description of how old someone is. The age range for a young person is a tad generous, reflecting the age of the author of this article. You have to use an If / Else Ifclause instead. But even if you could, you’d still have to type in lots of unnecessary Break statements: switch (Age. Threshold). Suppose I want to attach code to anything but the default Click event of a typical button: Let’s suppose that I want to attach code to the Mouse. Hover event of this button. I can do this in Visual Basic without leaving the code window: a) First choose the object from the drop list. Then choose the event you want to code. In C# you can’t do this – you have to return to the button’s properties window and choose to show its events: You can double- click to attach code to this event for the selected button – but that’s the only simple way to create it for C#. But it’s even worse than that. If you then rename a control (in this case btn. Apply) you have to re- associate the event- handler with the renamed control in the properties window (or in the initialisation code, if you can find it). In Visual Basic, of course, you can do all of this in code: .
ABSTRACT Author Hao Chen Title Comparative Study of C, C++, C# and Java Programming Languages Year 2010 Language English Pages. There are hundreds of programming languages in use today. How can you know which one to learn first? How do you know which ones are the best for your IT field of choice? Well, I can't answer that question for you. This is a quotation from Gertrude Stein’s 1922 play Geography and Plays. However, the poetry wouldn’t work in C#, because – unforgivably – it’s a cASe-SeNSitIvE language. Before I start ranting, let. Consider this table of C# symbols and their VB equivalents: What you’re trying to do. C# Symbol. VB Equivalent. Test if two conditions are both true& & and. Test if one or other condition is true? Autocorrection in Visual Basic actually works Intelli. Sense works much better for Visual Basic than for Visual C#. Take just one example – creating a write- only property. Let’s start with Visual Basic: When you press return at the line end. I’ve just spent ages transcribing our VB courses into C#, and believe me, there are many, many more! Lack of supported functions Here are a couple of functions I use from time to time in VB: Function. What it does. Is. Numeric. Tests if a value can be converted to a number. PMTCalculates the annual mortgage payment for a loan. Great functions, but they don’t exist in C#. That wretched semi- colon Why do I have to end every line in C# with a semi- colon? The argument used to be that it avoided the need to use continuation characters in Visual Basic: Message. Box. Show(. Come on, C#: Visual Basic has ditched its line- ending character; why can’t you?(; ) Someone commented on my original (much shorter) blog about this: ! Arguments and variables The order of words in a C# variable declaration is wrong. When you introduce someone, you wouldn’t say, “This is my friend who’s a solicitor; he’s called Bob”. So why do you say: To me: 1. Dim. Person. Name. As. String=. I also find the C# method of having to prefix arguments with the word out confusing, particularly as you have to do it both in the called and calling routine. Strictness C# is a much fussier language than Visual Basic (even if you turn Option Strict on in Visual Basic, this is still true). Consider this Visual Basic code: Enum. Age. Band. To do the same thing in Visual C#, you have to copy the array, add a value and then copy it back: The vile, clunky C# method of extending an array. Critics will tell me that: Behind the scenes, the Redim Preserve command does exactly the same thing as the C# code above; and I should be using lists and not arrays anyway. That’s hardly the point! The point is that – as so often – Visual Basic makes something easier to code than C# does. Conclusion So those are my 1. Visual Basic. What are you waiting for, all you C# code- monkeys? Convert all of your code to VB – you have nothing to lose but your semi- colons! Robot Check. Enter the characters you see below. Sorry, we just need to make sure you're not a robot. For best results, please make sure your browser is accepting cookies.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2016
Categories |