|
OriginalGriff wrote: var was bad enough, but at least it has a need - Linq won't work without it
Really?
I'm not having a good enough understanding of the plumbing behind Linq to be able to say you're wrong, but you can always select real types instead of anonymous types if you want to.
But yeah, the freaks that are known as linq to SQL spit and Linq to XML might be a different story.
OriginalGriff wrote: Error Resume Next is like an invisible empty catch block
It's rather quite visible.
The problem is rather, that actually handling errors in old VB was even worse. Just taste the syntax "On Error Goto ...", yes it says GOTO
I don't understand the need to always be backward compatible.
|
|
|
|
|
Afraid so - Linq works by creating anonymous types which are specific to the query - so if you don't have a "define this from context" variable type it can't do things like this:
var v = myCollection.Where(w => w.ID < 10).Select(s => new {ID = s.ID, Name = s.Name}); Because you can't declare
IEnumerable<WhatNameWillTheCompilerGiveThatDamnThing> v = ...
It only annoys me when people use it as a shortcut datatype:
var v = 123; Or to be really annoying
var v = GetSomething(somethingElse); because it may save you 5 seconds typing, but I'm going to have to hunt down the method declaration to try and work out the heck you are doing...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
And if you don't create anonymous types?
You'll get:
Person v = myCollection.Where(w => w.ID < 10).Select(s => new Person {ID = s.ID, Name = s.Name});
Works just fine converting types this way too, consider:
class Program
{
static void Main(string[] args)
{
List<SalesPerson> SalesPersons = new List<SalesPerson>();
SalesPersons.Add(new SalesPerson { ID = 1, Name = "Adam", IQ = 30 });
SalesPersons.Add(new SalesPerson { ID = 2, Name = "Benny", IQ = 40 });
SalesPersons.Add(new SalesPerson { ID = 3, Name = "C***", IQ = 20 });
List<Person> Persons = SalesPersons.Where(item => item.Name.StartsWith("B")).Select(item => new Person { ID = item.ID, Name = item.Name }).ToList();
Console.WriteLine(Persons.FirstOrDefault().Name);
Console.ReadKey();
}
}
public class Person
{
public int ID { get; set; }
public string Name { get; set; }
}
public class SalesPerson
{
public int ID { get; set; }
public string Name { get; set; }
public int IQ { get; set; }
}
Nothing anonymous there.
I do that a lot since I hate the fact that anonymous classes are local to the method they're created in.
So Ok that was not entirely true, you can actually pass anonymous types between methods, if you reuse the definition the compiler actually reuses the anonymous class. But that would require a lot of casting.
|
|
|
|
|
Was I that far off the target?
|
|
|
|
|
Jörgen Andersson wrote: Ever seen an empty catch? Hey! You been lookin' at my code?!
If you think 'goto' is evil, try writing an Assembly program without JMP.
|
|
|
|
|
There are perfectly legitimate reasons to have an empty catch block.
Just can't think of any right now.
|
|
|
|
|
OriginalGriff wrote: Anything you can do in C# you can do in VB.
Events based on delegates with non-void returns?
(My personal favorite.)
|
|
|
|
|
IMHO, problem-solving skills are more important than programming language skills. Once you are able to architect a solution, the language is not that important. Try to enhance your problem-solving skills. What the end user wants is a working solution, and is, more often than not, not bothered about what's under the hood.
Having said that, its better to work in a modern language, and VB is not likely one of them. Its better to learn languages useful for the web - HTML5, CSS, JS.
|
|
|
|
|
Absolutely you are right. I think too much and i have confidence and i can say i can solve any challanging problem in vb. But i want to tell that i am in a far village where internet is available but there is no any city near and this is backward area and i am not in contact with professional peoples where from i can take some work and do it by myself.
I shall like if someone gives me some programming work i shall do it free of cost because whole day i am free in these days. And it is better to do something than doing nothing.
I learnt programming by myself in home but i never did professional working i don,t know what is professionalism. So please someone attach with me i shall server him/her free and in result i shall become professional.
|
|
|
|
|
Only once i went to a city which is far from here and i stayed there 3 months and from there i came to know vb don,t have demand in markete. After this i searched internet and i found vb realy don,t have demand in markete.
|
|
|
|
|
There is a demand. Not a big demand, but it's there. All our new projects are in C# but we have legacy VB.NET apps, including one set of web services we just worked on to handle our migration from AS/400 to Oracle. There are probably a lot of shops like ours.
Do learn C#, though. I fought it for years, and now I love it. I do miss certain functions from VB, though.
If you think 'goto' is evil, try writing an Assembly program without JMP.
|
|
|
|
|
I know html, css, javascript, asp.net(razor view), php and many others but i am not professional in any of them.
|
|
|
|
|
Really nice that you know a number of languages, sitting in not-so-big-a-place. So, you know much more than we think you know - which is good for you now.
Now, to improve your professionalism, one way (since you have a reasonably good internet connection) is to go through other's articles and code. Look at this page[^] to get some ideas about how others have created their solutions in HTML5 - I mean, study the code. Come up with your own problems, and solutions based on the learning. You also need to improve your English, for which you need to catch a local person who knows reasonably good English.
Here is a challenge for you:
- Post your first tip or technical blog on this site.
- By date: 11 Aug 2015, two months from now.
- Should be a nice solution to a small problem you choose.
Will you take up this challenge? Yes. Start today ... now.
With this, you'll slowly and gradually improve your professionalism
Don't mind if your initial attempts don't succeed to your liking, but continue to persist. Never give up.
|
|
|
|
|
"- Post your first tip or technical blog on this site."
What mean by first tip and technical blog mean separate technical blog except this site.
Please explain in some details so that i can understand task fully.
|
|
|
|
|
At this place[^], you can post your tip.
--------------------------
From that site, here is the definition of a Tip:
"What is a Tip/Trick?
A tip ... is meant primarily to provide a quick coding solution or tip. Tips and Tricks are not as exhaustive or extensive, nor do they require as much detail as an article to explain a problem and its solution. ... A tip might be only a couple of paragraphs. Tips simply state a problem and a solution."
-----------------------------------
This is what I'd like you to post within the next two months. Of course, this requires a lot of effort on your side, and quite some learning. Your tip should be a really good one, standing on its own strength, and without any loop-holes.
We'll come to Technical Blog later (once you post the Tip).
|
|
|
|
|
VB and C# are both .NET. The biggest difference is some syntax.
If you know your stuff syntax shouldn't be a problem.
I started out in VB.NET and I love it. There's a lot of undeserved hate towards VB.
That said I started doing C# because it's much more main stream. After about a month of working in C# it just came natural.
|
|
|
|
|
Learn C#, C++ or Java. In your case, C# is the best bet.
Sure, there are other languages, but they are secondary, so have fun finding work after that first job.
Oh, and learn punctuation and how to use the shift key. Based on your writing, I'd toss your resume in the trash no matter what languages you knew.
|
|
|
|
|
Well I go with the suck it up response. I came up via VB, in the early 00s I took the team, 5 developers, from VB to c# because that is what the market wants and that is what most of the support resources are coded in. The more time you spend working in c# the more comfortable you will get.
So stop moaning, suck it up, and get on with it!
And 'bro' is not a sign of respect in most cultures.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
C# is not better than VB.Net, they both run on top of the same .Net stack. The rest is just syntax candy. Saying that I can write in C# or VB.Net and generally I write in C# as I prefer the syntax.
In the end its a job and the best choice is where the market demand is and that is generally in C#.
Why not learn C#, if you know VB.Net you need to learn the syntax but you already know the framework, it's what I did.
|
|
|
|
|
I have a VB background: VB 3, 4, 5, 6, VB.NET (MCSD for VB5, 6, and VB.NET)
I moved over to C# in 2007 exclusively.
Well, I was kinda forced to by my, then, employer.
I have not missed VB one iota.
MS can go ahead and kill VB
|
|
|
|
|
Pardon if this thread start is satire.
Because of years I spent developing tactical software in VBA and SQL, I found it easy to first convert to VB.NET and then C#. Not you personally, but if you cannot program in either, I find it funny, and privately think less of you, although one must consider the language barrier as an explanation. And I have met people that can only code in one, but because no one in my world codes VB.NET, it always happens to be C# people. A platform is a platform, and although there are some idiosyncrasies, the bulk of code can be written easily in one as the written in the other.
Also, please note, the VB.NET demand, according to Tiobe's index, is increasing, although my guess its usage in buried under ASP.NET and related technologies.
modified 12-Jun-15 9:08am.
|
|
|
|
|
To all the VB haters: Everyone always gives "On Error Resume Next" as the example of why VB is so horrible. Yes, using that is horrible coding - absolutely zero argument on that point.
But remember that this technique is generations old. Best Practice absolutely encourages Try/Catch - maybe MS should have removed support for the old methods, but if they did then you can imagine the backlash from developers who are trying to migrate older code. Everyone would be complaining that MS has failed to support effective migration!
Every language evolves, as has VB. Damn near 100% of the complaints that I see about VB are about the coder and not the framework. I've seen crap code in every language out there. I do agree that there's likely the perception that there is more crap code in VB, but I also believe a lot of that can be attributed to the number of programs that were written in VB historically, many by younger developers learning to code. Who on this forum believes, for one minute, that ALL C# code is being written by experienced developers? I can guarantee that in the years ahead we'll all be looking back at all the green developers that have been thrown into C# projects and seeing a flood of complaints about their crap code as well. No different than PHP or Ruby.
Crap code isn't just good error trapping, it's also consistent naming conventions, adequate comments, good class structure, proper OOP, effective use of patterns, etc. VB supports all this just as well as C#. VB will NOT stop someone from writing bad code. Neither will C# - at best it reduces, by a VERY small fraction, the opportunity for writing some bad code. But when you consider all of the things that can make bad code, it doesn't take long to realize that C# can't stop 99.9% of it. Buying a Ferrari doesn't make someone a better driver.
/endrant
To the OP: If you like VB, great. I will say that, these days (as you are discovering), it is likely becoming harder to find work in that field. And whether you decide to push towards C# or some other platform you have to recognize that, as a developer, you will constantly need to be learning and that (very important) over your lifetime you will have to learn new platforms or risk becoming obsolete and out of work. That has nothing to do with VB... the same fate can befall you in any platform. Be prepared to continue learning - it's the nature of this career path. If you find work in VB, great, but I would still encourage taking the time to continue your C# learning. I don't agree that it's light-years better than VB (as others seem to believe), but the reality is that it's where the market is right now and sooner or later you will have to accept that fact.
Best of luck.
|
|
|
|
|
Your question is a good one!
1) Last year MS rebuilt VB.Net from the ground up for VS 2015. With that level of effort, VB.Net is not going away.
2) When MS first developed .Net, they created the C# language to mimic Java. The plan was to entice Java developers to begin working with MS's .Net in VS. That plan worked!
3) The first C# developers had Java experience. This meant that they were already experienced and professional. The first VB.Net developers had experience with VB6, and some of them were individual developers, and some came from companies. So, the average experience level among new C# developers was higher than the average experience level among new VB.Net developers.
4) The early versions of C# and VB.Net had a lot of differences. Developers from both languages persistently asked MS to include features from the other language into theirs. MS began doing this (with VS 2010) with each new release. Today, the languages have far fewer differences - so the choice of language is a objectively arbitrary.
5) VS allows a solution to be made of multiple projects, and each project must use only one language. Projects within a solution can use different languages - so a solution doesn't have to be all C# or all VB.Net.
6) Some C# developers sometimes take the opportunity to be derisive toward VB.Net developers and the VB.Net language. Ignore it. Between C# and VB.Net, today's developers are all good, regardless of which language they program in. One developer putting down a language or a developer just because of a language difference is a clear sign of emotional immaturity. When you hear something like that you've learned something about the developer, not about the languages.
The reason you are finding more work with C# over VB.Net is due to the history of the two languages, not due to either language, as they work today, being better than the other language.
Learning both languages makes you more valuable - you'll be available for more jobs. You'll know that you can always find work, but you can always get the work you want when you find it.
Best of luck!
Dan
|
|
|
|
|
|
First,
This is perfectly natural. BASIC was the first language I learned, but C was always my true love. I learned Macro-11 Assembly on a PDP/11 and the C language was developed against an earlier version of this Assembler. So when I start reading in C, I felt the power, and loved the simplicity.
Second,
To switch, requires immersion. You should start READING C# projects, and tons of them. Keep reading them, and reading them. You should read each line, and know what it is in VB.Net. But keep reading it in C#. Like learning a second spoken language, at first, you will translate to understand. But once you "know" the implication/meaning of specific lines, you will no longer translate them. then, soon, you will no longer translate 3-5 lines at a time. Finally, you will be FLUENT enough.
Third,
Join a Dojo type site that asks you to solve problems using C#.
Like a child starts with alphabets, and then small words, start with the easiest problems. Solve them in C#, and keep at it. I would say 1hr a day, every day. More if you can do it.
In about 30-60 days, your comfort with C# should be significantly better.
And keep at it. Until your first thought of a new problem is how you would do it in C#
that is when you have graduated to the first level.
The point is that your love for VB is your love for its familiarity. It rolls off of your tongue, so to speak. But the market knows best, and VB is not it. VB Is good for beginners. And hence your dilemma.
|
|
|
|
|