Great Confusing Problem with VB.NET developers
-
Even I, who have grown up American and worked in San Francisco and New York City, and even used to buy fast food from McDonalds, don't really understand the meaning of the phrase "Would you like fries with that?". I laugh about it when others say it, pretending to understand, but I don't. Do you expect someone for whom English is a second language to understand it? So, if you can explain it, please do.
-
Appologize if this is childish question but i am in too much confusion. I learnt first language vb6.0 in 2008 then i was student later and i continue it many years then 2 years ago i shifted to vb.net but in markete there is demand of c#. Many peoples told that c# is better than vb.net that,s why there is no value of vb.net in markete. I still can,t find any job to work in vb.net while i know vb well. Then i learnt C++ and i learnt it well and then i moved to c# and now i can code in c#. But problem is that i can,t code in c# same as in vb.net. I mean i always prefer vb. In vb i can solve any problem. but in c# i have to search from start and i don,t know why i like vb.net too much. In other words i don,t want to leave vb but markete always force to work in c# and foget vb. If vb is too bad in markete then why microsoft still supports it. Microsoft must close vb because they can,t give good markete to vb. Due to this reasons vb only developers are still poor in markete. They can switch to c# easly but their hearts shall always stick with vb. I know many languages like vb,c#,java,asp.net,php,mysql,sql etc but my heart always stick with vb. When i code in other language except vb then i always think to do that task in vb also. I love vb but what should i do while markete don,t have demand of vb?
Forget all the haters. VB.net is a great echo system; unfortunately it got the name "VB" in it and the holy wars happened. The MS started pushing C# as the end all be all, but vb.net and C# are equivalent. the second issue for the holly war is C# name (and code) looks like C, C++; so people (shops) tend to equate C# = C++ (fast and efficient) and VB.net = VB6 (hobbyist and interpreted code). It's stupid, I know. We all (should) know C#=VB.net close to 95%; one is not faster then the other since they both exist on the same runtime. If VB.net had been named something like: N# and C# named something like O#, no one would be having this argument right now. and equal shops would be hiring for both N# and O#; preference being if you like "}" or "end sub" That said we all have to work; so you do what you have to. Luckily I work for a place that let me choose the direction for all new projects; so it's almost always VB.net. But I still like messing with C (sorry guys C++ feels too messy too me) and Dlang.org looks promising.
-
Appologize if this is childish question but i am in too much confusion. I learnt first language vb6.0 in 2008 then i was student later and i continue it many years then 2 years ago i shifted to vb.net but in markete there is demand of c#. Many peoples told that c# is better than vb.net that,s why there is no value of vb.net in markete. I still can,t find any job to work in vb.net while i know vb well. Then i learnt C++ and i learnt it well and then i moved to c# and now i can code in c#. But problem is that i can,t code in c# same as in vb.net. I mean i always prefer vb. In vb i can solve any problem. but in c# i have to search from start and i don,t know why i like vb.net too much. In other words i don,t want to leave vb but markete always force to work in c# and foget vb. If vb is too bad in markete then why microsoft still supports it. Microsoft must close vb because they can,t give good markete to vb. Due to this reasons vb only developers are still poor in markete. They can switch to c# easly but their hearts shall always stick with vb. I know many languages like vb,c#,java,asp.net,php,mysql,sql etc but my heart always stick with vb. When i code in other language except vb then i always think to do that task in vb also. I love vb but what should i do while markete don,t have demand of vb?
VB is much more humane. C like languages are for technoids. VB is more DSL. C like languages are "hw" oriented. The original VB had great success, but unfortunately MS choked him and ceased to evolve. And he did not even open source. Why? Still there is no VB equivalent in .net. I mean holy trinity VB & VBA & VBS. It's just not in .net. For those who still do not believe just fast example: Execute, ExecuteGlobal and Eval ... Fortunately there is a jQuery ANGULARJS and other seasonings. The only thing I miss them is case-insensitive. Case sensitive is the sheer poverty of thought. No contribution to the quality of programs and nerves of programmers. Anyway, it discards the compiler and converts to numero :-) For example, filename in MSWindows and emails are case insensitive. And so it should be. When a MS VB hiding, never mind. There is BPMN, Angular, Node, Mongo and more. One family of open source and more. When you pardon case insensitive, so it can be a very nice HIGH-level programming.
-
Appologize if this is childish question but i am in too much confusion. I learnt first language vb6.0 in 2008 then i was student later and i continue it many years then 2 years ago i shifted to vb.net but in markete there is demand of c#. Many peoples told that c# is better than vb.net that,s why there is no value of vb.net in markete. I still can,t find any job to work in vb.net while i know vb well. Then i learnt C++ and i learnt it well and then i moved to c# and now i can code in c#. But problem is that i can,t code in c# same as in vb.net. I mean i always prefer vb. In vb i can solve any problem. but in c# i have to search from start and i don,t know why i like vb.net too much. In other words i don,t want to leave vb but markete always force to work in c# and foget vb. If vb is too bad in markete then why microsoft still supports it. Microsoft must close vb because they can,t give good markete to vb. Due to this reasons vb only developers are still poor in markete. They can switch to c# easly but their hearts shall always stick with vb. I know many languages like vb,c#,java,asp.net,php,mysql,sql etc but my heart always stick with vb. When i code in other language except vb then i always think to do that task in vb also. I love vb but what should i do while markete don,t have demand of vb?
Don't listen to the VB haters , they know not what they speak.I've been developing with VB since it's inception and I've never been busier. 2014 was the 2nd best year for revenue in my 40 years of working. I regularly turn down work I'm so busy. :) Email me direct and I'll gladly point you in the right direction.
-
Forget all the haters. VB.net is a great echo system; unfortunately it got the name "VB" in it and the holy wars happened. The MS started pushing C# as the end all be all, but vb.net and C# are equivalent. the second issue for the holly war is C# name (and code) looks like C, C++; so people (shops) tend to equate C# = C++ (fast and efficient) and VB.net = VB6 (hobbyist and interpreted code). It's stupid, I know. We all (should) know C#=VB.net close to 95%; one is not faster then the other since they both exist on the same runtime. If VB.net had been named something like: N# and C# named something like O#, no one would be having this argument right now. and equal shops would be hiring for both N# and O#; preference being if you like "}" or "end sub" That said we all have to work; so you do what you have to. Luckily I work for a place that let me choose the direction for all new projects; so it's almost always VB.net. But I still like messing with C (sorry guys C++ feels too messy too me) and Dlang.org looks promising.
For me it has nothing to do with hate; it has to do with getting a [good paying] job doing the kind of work you enjoy. For example, even though I know C# quite well, I de-emphasize it on my resume because I don't enjoy working with the web (I prefer C++ in the embedded space where someone else is worrying about the UI and the drivers--not easy to find work, but that space is what I've always enjoyed working in, starting with Assembly language, moving to C and now C++ with some C# mixed in.)
-
Appologize if this is childish question but i am in too much confusion. I learnt first language vb6.0 in 2008 then i was student later and i continue it many years then 2 years ago i shifted to vb.net but in markete there is demand of c#. Many peoples told that c# is better than vb.net that,s why there is no value of vb.net in markete. I still can,t find any job to work in vb.net while i know vb well. Then i learnt C++ and i learnt it well and then i moved to c# and now i can code in c#. But problem is that i can,t code in c# same as in vb.net. I mean i always prefer vb. In vb i can solve any problem. but in c# i have to search from start and i don,t know why i like vb.net too much. In other words i don,t want to leave vb but markete always force to work in c# and foget vb. If vb is too bad in markete then why microsoft still supports it. Microsoft must close vb because they can,t give good markete to vb. Due to this reasons vb only developers are still poor in markete. They can switch to c# easly but their hearts shall always stick with vb. I know many languages like vb,c#,java,asp.net,php,mysql,sql etc but my heart always stick with vb. When i code in other language except vb then i always think to do that task in vb also. I love vb but what should i do while markete don,t have demand of vb?
Your confusion is understandable. However, we should get some basic myths out of the way so you can understand your confusion. First and foremost, there is no difference in performance capability between VB.NET and C# as they both compile directly to the .NET Framework, which is what processes all of the compilations. There may be some minor differences in terms of how specific areas of code are defined but that is about it. Two, as a result of the first item, the only major difference between VB.NET and C# is the syntax. Three, the syntax of both languages are completely convertible to the other with some minor differences in conversion capabilities with specific code. There are several free online conversion utilities that provide such services that you can avail yourself of. One good one is found at http://www.developerfusion.com. The commenters here that suggest you work in C# professionally while doing your personal projects in VB.NET is a very legitimate suggestion. Many software professionals and companies prefer C# over VB.NET for the most nonsensical reasons; the most common one being that it is believed that C/C++ syntax, which C# mirrors, is superior and cleaner whereas VB.NET syntax is considered too verbose. They are correct but who cares? Its not the syntax that executes any application. Like you, I much prefer VB.NET but then I am a product of the 4th generation languages that were highly popular in the DBASE world when it was the king of software development. However, I am just as fluent in C#. Learn C# simply by reviewing how easy it is to simply move VB.NET code into C# syntax for the most part. There are differences but if you use VB.NET as a guide you should feel a natural affinity for C# in a few months. Then you will be "multi lingual" and more adept at securing employment...
Steve Naidamast Sr. Software Engineer Black Falcon Software, Inc. blackfalconsoftware@outlook.com
-
Appologize if this is childish question but i am in too much confusion. I learnt first language vb6.0 in 2008 then i was student later and i continue it many years then 2 years ago i shifted to vb.net but in markete there is demand of c#. Many peoples told that c# is better than vb.net that,s why there is no value of vb.net in markete. I still can,t find any job to work in vb.net while i know vb well. Then i learnt C++ and i learnt it well and then i moved to c# and now i can code in c#. But problem is that i can,t code in c# same as in vb.net. I mean i always prefer vb. In vb i can solve any problem. but in c# i have to search from start and i don,t know why i like vb.net too much. In other words i don,t want to leave vb but markete always force to work in c# and foget vb. If vb is too bad in markete then why microsoft still supports it. Microsoft must close vb because they can,t give good markete to vb. Due to this reasons vb only developers are still poor in markete. They can switch to c# easly but their hearts shall always stick with vb. I know many languages like vb,c#,java,asp.net,php,mysql,sql etc but my heart always stick with vb. When i code in other language except vb then i always think to do that task in vb also. I love vb but what should i do while markete don,t have demand of vb?
half the problem is there are too many coding snobs who think vb is some poor relation to c# but its the skill of the programmer that counts and a poor coder will always be a poor coder no matter what the language. i've written commercial apps in every incarnation of vb since the 70's and never had a problem, selling many thousands of copies as well as larger bespoke commissions. VB.NET compiles to the same IL as any .NET language so there's no speed issues, and ive never needed to change, my customers don't even ask what language its written in, they are only concerned with the results. Broaden your searches and follow your instinct of what you wish to do. GL
-
OriginalGriff wrote:
Most of the stuff you can do in VB that you can't in C# improves the quality of code and the ease of maintenance. String typing rather than weak typing is the major plus here
I'll just mention
dynamic
then. :-DOriginalGriff wrote:
On Error Resume Next
Ever seen an empty catch? Don't blame crappy programming on the language. Basic was originally pushed as a beginners language, but after all the bashing all beginners nowadays learn Java or C#. Take another good look at Q&A some time. I'd say there are more stupid questions regarding C# than VB.Net nowadays. Not to mention JavaScript. :~
Wrong is evil and must be defeated. - Jeff Ello
-
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.
-
Jörgen Andersson wrote:
I'll just mention
dynamic
thenPlease, don't.
var
was bad enough, but at least it has a need - Linq won't work without it.dynamic
is a retrograde step IMO.Jörgen Andersson wrote:
Ever seen an empty catch?
On Error Resume Next is like an invisible empty catch block round every single line of code...empty catch is bad enough, but when you can't even see them? :laugh:
Jörgen Andersson wrote:
Don't blame crappy programming on the language.
I don't: you can write cr@p code in any language and (with a bit of work sometimes) you can write excellent code in every language. But some languages encourage good code, by making it harder to make mistakes. And some languages encourage cr@p code by making it harder to do things properly!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
OriginalGriff wrote:
var
was bad enough, but at least it has a need - Linq won't work without itReally? 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 :wtf: I don't understand the need to always be backward compatible.
Wrong is evil and must be defeated. - Jeff Ello
-
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. :)
Wrong is evil and must be defeated. - Jeff Ello
-
Bro! You are absolutely right. There are many commands in vb which can,t be converted in C# but most people don,t accept this reality. I am also feeling myself a newbie and worrying about it. I never think i can,t do something in programming but when i look to markete then this reality comes that vb don,t have demand. With passing time while i am practicing c# i am found that it is realy becoming easy for but in heart i still prefer vb upon c#.
Yeah, I have seen this discussed from time to time. For Microsoft, VB.net carries almost no expense as they do not have to maintain a separate compiler. Visual Studio just translates both C# and VB.net into the intermediate language (CIL?) which then gets compiled. (Actually I have heard C# described as C++ with VB goodness baked inside). Interestingly, according to TIOBE this month VB.net ranks #7, between Python at #6 and PHP at #8. Even Visual Basic (VB6?) ranks at #11 just above Perl. There are a lot of prejudices out there. I have noticed hard-core C programmers tend to look down their noses at C++ and C# folks. Then again Assembler programmers tend to look down on all the Compiler folks (C included), who in turn tend to look down on folks using Interpreted languages. Then again I am sure that 50 years ago there were folks entering programs on the register switches in front of computers back then who thought the Assembler folks were clots (I did this once, no great fun tho). In short, Member 9993589, welcome to programming!
-
Appologize if this is childish question but i am in too much confusion. I learnt first language vb6.0 in 2008 then i was student later and i continue it many years then 2 years ago i shifted to vb.net but in markete there is demand of c#. Many peoples told that c# is better than vb.net that,s why there is no value of vb.net in markete. I still can,t find any job to work in vb.net while i know vb well. Then i learnt C++ and i learnt it well and then i moved to c# and now i can code in c#. But problem is that i can,t code in c# same as in vb.net. I mean i always prefer vb. In vb i can solve any problem. but in c# i have to search from start and i don,t know why i like vb.net too much. In other words i don,t want to leave vb but markete always force to work in c# and foget vb. If vb is too bad in markete then why microsoft still supports it. Microsoft must close vb because they can,t give good markete to vb. Due to this reasons vb only developers are still poor in markete. They can switch to c# easly but their hearts shall always stick with vb. I know many languages like vb,c#,java,asp.net,php,mysql,sql etc but my heart always stick with vb. When i code in other language except vb then i always think to do that task in vb also. I love vb but what should i do while markete don,t have demand of vb?
I have similar sentiments and history. I started (professionally) in VB 3/4 back in the late 90s. I also know a dozen different languages and several platforms. I was forced into C# about 3ish years ago. The kicker is I actually agreed with the move; it made good business sense… and made me a bit sad. I’ll always be in love with BASIC. Its current face is VB.NET, but who knows where that’ll be in the future. The simple truth is that Microsoft backs C# more than VB. As I recall, in .Net Rocks Episode # 1140 (@ 43 minutes) Jay Schmelzer talks about how new language features will usually be in C# first, then added to the others. It’s sucks, but that’s the way it is. Quell the automatic reaction and ask yourself why. My opinion is that it is Java’s fault. Microsoft is trying to attract Java devs to .NET. C# can get that job done, VB can’t.
Quote:
Many peoples told that c# is better than vb.net...
Anybody who says C# is “better” than VB.net is an idiot. (Or even VB.net is “better” than C#) They simply don’t understand the .NET platform. Inform them if you can, but try not to argue. It’ll make you look as dumb as them. Microsoft’s brilliance is .NET… not VB, C#, or F#. They are just tools.
Quote:
But problem is that i can,t code in c# same as in vb.net
I also tended to write code in VB, and then translate into to C#. Practice will make it more nature.
Quote:
I love vb but what should i do while markete don,t have demand of vb?
People still write COBOL!!! They’re not as many COBOL jobs today, but they still exist. They’ll also be harder to find. I’d suggest figuring out what you want to do: be a VB.NET specialist or a generalist able to do both VB and C#. Then take a look at the job market(s) you have access to. Do enough possible jobs exist to support a specialist? If it does, then raise your rates and apply. If it doesn’t, well, either become a generalist or move to a different market.
- great coders make code look easy - When humans are doing things computers could be doing instead, the computers get together late at night and laugh at us. - ¿Neal Ford?
-
Appologize if this is childish question but i am in too much confusion. I learnt first language vb6.0 in 2008 then i was student later and i continue it many years then 2 years ago i shifted to vb.net but in markete there is demand of c#. Many peoples told that c# is better than vb.net that,s why there is no value of vb.net in markete. I still can,t find any job to work in vb.net while i know vb well. Then i learnt C++ and i learnt it well and then i moved to c# and now i can code in c#. But problem is that i can,t code in c# same as in vb.net. I mean i always prefer vb. In vb i can solve any problem. but in c# i have to search from start and i don,t know why i like vb.net too much. In other words i don,t want to leave vb but markete always force to work in c# and foget vb. If vb is too bad in markete then why microsoft still supports it. Microsoft must close vb because they can,t give good markete to vb. Due to this reasons vb only developers are still poor in markete. They can switch to c# easly but their hearts shall always stick with vb. I know many languages like vb,c#,java,asp.net,php,mysql,sql etc but my heart always stick with vb. When i code in other language except vb then i always think to do that task in vb also. I love vb but what should i do while markete don,t have demand of vb?
VB made you soft and weak, now you pay the price for ignoring advice.
-
OriginalGriff wrote:
var
was bad enough, but at least it has a need - Linq won't work without itReally? 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 :wtf: I don't understand the need to always be backward compatible.
Wrong is evil and must be defeated. - Jeff Ello
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... :mad:
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
Appologize if this is childish question but i am in too much confusion. I learnt first language vb6.0 in 2008 then i was student later and i continue it many years then 2 years ago i shifted to vb.net but in markete there is demand of c#. Many peoples told that c# is better than vb.net that,s why there is no value of vb.net in markete. I still can,t find any job to work in vb.net while i know vb well. Then i learnt C++ and i learnt it well and then i moved to c# and now i can code in c#. But problem is that i can,t code in c# same as in vb.net. I mean i always prefer vb. In vb i can solve any problem. but in c# i have to search from start and i don,t know why i like vb.net too much. In other words i don,t want to leave vb but markete always force to work in c# and foget vb. If vb is too bad in markete then why microsoft still supports it. Microsoft must close vb because they can,t give good markete to vb. Due to this reasons vb only developers are still poor in markete. They can switch to c# easly but their hearts shall always stick with vb. I know many languages like vb,c#,java,asp.net,php,mysql,sql etc but my heart always stick with vb. When i code in other language except vb then i always think to do that task in vb also. I love vb but what should i do while markete don,t have demand of vb?
You go right ahead and stick with VB if that's what you're comfortable writing (particularly if you're 'on your own' consulting. The client doesn't care what language you use!) I've written (and still do) professional VB (both VB6 and .Net) as well as a lot of C#. I write some Javascript, spent about 15 years writing C/C++ and a dozen or so writing assembly, and even FORTRAN (back in the 'old' days). Unless you're in some shop that REQUIRES you use a particular language for development (or trying to impress someone with esoteric or terse looking code) rather than getting RESULTS then, as I said, use the one you like. Personally I think VB has some real charm to it (as well as being just as functional as C#). There's a lot of language bigots out there. Just ignore them. -CM :-)
-
I have similar sentiments and history. I started (professionally) in VB 3/4 back in the late 90s. I also know a dozen different languages and several platforms. I was forced into C# about 3ish years ago. The kicker is I actually agreed with the move; it made good business sense… and made me a bit sad. I’ll always be in love with BASIC. Its current face is VB.NET, but who knows where that’ll be in the future. The simple truth is that Microsoft backs C# more than VB. As I recall, in .Net Rocks Episode # 1140 (@ 43 minutes) Jay Schmelzer talks about how new language features will usually be in C# first, then added to the others. It’s sucks, but that’s the way it is. Quell the automatic reaction and ask yourself why. My opinion is that it is Java’s fault. Microsoft is trying to attract Java devs to .NET. C# can get that job done, VB can’t.
Quote:
Many peoples told that c# is better than vb.net...
Anybody who says C# is “better” than VB.net is an idiot. (Or even VB.net is “better” than C#) They simply don’t understand the .NET platform. Inform them if you can, but try not to argue. It’ll make you look as dumb as them. Microsoft’s brilliance is .NET… not VB, C#, or F#. They are just tools.
Quote:
But problem is that i can,t code in c# same as in vb.net
I also tended to write code in VB, and then translate into to C#. Practice will make it more nature.
Quote:
I love vb but what should i do while markete don,t have demand of vb?
People still write COBOL!!! They’re not as many COBOL jobs today, but they still exist. They’ll also be harder to find. I’d suggest figuring out what you want to do: be a VB.NET specialist or a generalist able to do both VB and C#. Then take a look at the job market(s) you have access to. Do enough possible jobs exist to support a specialist? If it does, then raise your rates and apply. If it doesn’t, well, either become a generalist or move to a different market.
- great coders make code look easy - When humans are doing things computers could be doing instead, the computers get together late at night and laugh at us. - ¿Neal Ford?
You spoke golden words. It is really nice answer that if markete have demand of vb specialist then i should become vb specialist other wise i should be a generalist and should work in both vb and c#. But here c# has more preference so i should become generalist. But it is reality i can code more better than c#.
-
Forget all the haters. VB.net is a great echo system; unfortunately it got the name "VB" in it and the holy wars happened. The MS started pushing C# as the end all be all, but vb.net and C# are equivalent. the second issue for the holly war is C# name (and code) looks like C, C++; so people (shops) tend to equate C# = C++ (fast and efficient) and VB.net = VB6 (hobbyist and interpreted code). It's stupid, I know. We all (should) know C#=VB.net close to 95%; one is not faster then the other since they both exist on the same runtime. If VB.net had been named something like: N# and C# named something like O#, no one would be having this argument right now. and equal shops would be hiring for both N# and O#; preference being if you like "}" or "end sub" That said we all have to work; so you do what you have to. Luckily I work for a place that let me choose the direction for all new projects; so it's almost always VB.net. But I still like messing with C (sorry guys C++ feels too messy too me) and Dlang.org looks promising.
Yes there is difference only of names. Many times when i talk to non programmers about langauges and tell them about visual basic they always focus on word "basic" and think it is a basic language only and it is not advanced language it is just basic language. While C# reputation is hidden in it,s name, when people listen c# they think it is C/C++ or same like this.
-
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... :mad:
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 SalesPersons = new List(); 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 = "Cunt", IQ = 20 }); List 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.
Wrong is evil and must be defeated. - Jeff Ello
-
VB made you soft and weak, now you pay the price for ignoring advice.