locked
VB.Net VS C#

    General discussion

  • Hi,

     

    Which language, VB.Net or C# is the best language to choose for development right now?

     

    Needing users to have the .Net framework is something that I see as a drawback to Vb.NET, but what are the pro's and con's of each language? What can be achieved with one but not the other?

     

    Edit: This is a serious predicament, I am paying somebody to develop a program for my company, and I need to chose VB.Net or C#.

    Sunday, July 18, 2010 10:12 AM

All replies

  • Be aware that this kind of questions marks a troll, but if you ask it serious

    Complete personal choise, is a same question like who are better Americans or Brits

    Intended is that the languages have parity, however, sometimes there are partially some slight differences.

    What you see as drawbacks from VB are therefore exactly the same for C#


    Success
    Cor
    Sunday, July 18, 2010 10:38 AM
  • I aplogise if it sounded like that. This is a totally serious question however, I am paying somebody to develop software for my company, and I need to chose whether it should be developed in VB.NET or C#.

     

    Do C# require .Net framework as well?

     

    What are the specific pros and cons?

    Sunday, July 18, 2010 10:57 AM
  •  
    "koalacatcher" wrote in message news:7c79cf05-7c7b-4558-b678-e426fdad1214...
    Hi,
     
    Which language, VB.Net or C# is the best language to choose for development
    right now?
     
    Needing users to have the .Net framework is something that I see as a
    drawback to Vb.NET, but what are the pro's and con's of each language? What
    can be achieved with one but not the other?
     
    my
    response ----------------------------------------------------------------------------------------------------
     
    It's a stupid question. Both are OOP languages and both use the .NET
    Framework as Managed code languages. VB.NET is proprietary to MS, and C#.NET
    is standard controlled by the ISO and ECMA.
     
     
    What is Object-oriented-programming?
     
    (OOP) is a programming paradigm that uses "objects" and their interactions
    to design applications and computer programs.
     
    The key concepts of OOP are the following:
     
    Class
     
    Object
     
    Instance
     
    Method
     
    Message passing
     
    Inheritance
     
    Abstraction
     
    Encapsulation
     
    Polymorphism
     
    Decoupling
     
     
     
    http://en.wikipedia.org/wiki/Object-oriented_programming
     
    No matter what development platform Java, .Net or others OOP is OOP.
     
    http://math.hws.edu/eck/cs124/downloads/OOP2_from_Univ_KwaZulu-Natal.pdf
     
    http://www.blackwasp.co.uk/ObjectOrientedConcepts.aspx
     
     
    Sunday, July 18, 2010 10:58 AM
  • @Darnold92: I just updated my post to outline why I need to know.
    Sunday, July 18, 2010 11:00 AM
  • I've answered to you, there is nothing more to add, it is mainly personal preference.

    If you have greath experience with C or JavaScript take C#, if you have greath expirience with VBS or/and VBA take VB.Net.

    In other words if you like to use curly bracelets and semicolons take C#, if you like to describe ends more in words take VB Net.

    Technicaly they do exactly the same and need exactly the same.

    Somebody who is a good developer, knows both, but has also a preference, ask in what language he produces and maintain the best program.

    If he/she start telling techincal differences, then you have to do with an amateur and you can better take somebody else (with the exception currently if you want to develop for mobile 7).


    Success
    Cor
    Sunday, July 18, 2010 11:06 AM
  •  
    "koalacatcher" wrote in message news:24b838e1-cd2d-4d23-9aa6-4838c9d585a9...
    @Darnold92: I just updated my post to outline why I need to know.
     
    My response -----------------------------------------------------------------------------------------------------------
     
    And I told you the differences about the two languages. MS owns VB.NET. MS doesn't own C# .NET. Both are OOP programming languages. Both are Managed code languages managed by the .NET Framework, CLI and CLR.
     
    The .NET language that is more widely used is C#.NET, because it's a standard controlled by the ISO and ECMA. It's one's preference as to which one he or she uses based on one's expertise, because they both have to use the .Net Framwork and the framework is the framework. Some people use both languages and he or she can switch between the two easily. The key here is the .NET Framework. Does one understand how to use the .NET Framework?
     
     
    Sunday, July 18, 2010 11:18 AM
  • The .NET language that is more widely used is C#.NET, because it's a standard controlled by the ISO and ECMA. It's one's preference as to which one he or she uses based on one's expertise, because they both have to use the .Net Framwork and the framework is the framework. Some people use both languages and he or she can switch between the two easily. The key here is the .NET Framework. Does one understand how to use the .NET Framework?
     
     

    You put this in a trolling thread, the number one program language for Microsoft is Visual Basic for Net and second C++

    For your statement that C# is more widely used is not any real proof beside that some C# adepts have written that.

    It is mostly based on the fact that there are more books written for C# than for Visual Basic.  

    But likewise there are written for instance more books for learning English than for Chinese, that does not proof that English is spoken by more persons as first language.

    Also you wrote about controlled by ISO and ECMA, which says nothing. Controlled by boards means mostly less progress.  Cobol has been controlled forever, that was probably the main reason why it was unable to get the transistion to desktop and web and stayed a process language.

    So let's keep it to personal preference, for your other sencenses is not any proof.

     

     


    Success
    Cor
    Sunday, July 18, 2010 11:34 AM
  •  
    "Cor Ligthert" wrote in message news:8b9c0d38-8154-4a8a-97bb-dbd329d2c0bf...
    The .NET language that is more widely used is C#.NET, because it's a standard controlled by the ISO and ECMA. It's one's preference as to which one he or she uses based on one's expertise, because they both have to use the .Net Framwork and the framework is the framework. Some people use both languages and he or she can switch between the two easily. The key here is the .NET Framework. Does one understand how to use the .NET Framework?
     
     

    You put this in a trolling thread, the number one program language for Microsoft is Visual Basic for Net and second C++

    my response---------------------------------------------------------------------------------------

    I don't see that when I am looking for my next .NET contact. What I see is C#.NET that is more prevelant than VB.NET when it comes to jobs.

    ---------------------------------------------------------------------------------------------------------------------

    For your statement that C# is more widely used is not any real proof beside that some C# adepts have written that.

    my response------------------------------------------------------------------------------------------------------------------------

    I would say that C#. NET is more widely used on Windows form, Console, Web based forms, Web services, Windows services, WCF and SOA,  MVC, MVP and n-tier applications than VB.NET. 

    -----------------------------------------------------------------------------------------------------------------------------------------

    It is mostly based on the fact that there are more books written for C# than for Visual Basic.  

    my response--------------------------------------------------------------------------------------------------------------------------

    I have to disagree.

    -----------------------------------------------------------------------------------------------------------------------------------------

    But likewise there are written for instance more books for learning English than for Chinese, that does not proof that English is spoken by more persons as first language.

    my response--------------------------------------------------------------------------------------------------------------------------------

    What does this have to do with anything?

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------\ 

    Also you wrote about controlled by ISO and ECMA, which says nothing. Controlled by boards means mostly less progress.  Cobol has been controlled forever, that was probably the main reason why it was unable to get the transistion to desktop and web and stayed a process language.

    my response-------------------------------------------------------------------------------------------------------

    I disagree particularly so, when working for a insitution or company that is heavily regulated. And those regulations are dicated by the ISO and ECMA. So they are going to look for a software devlopment paltform that is regulated likewise. I have been there and done that.

    ----------------------------------------------------------------------------------------------------------------

    So let's keep it to personal preference, for your other sencenses is not any proof.

    my response ---------------------------------------------------------------------------------------

    You git a lot of lip service. Can you say PCKB?

     

    Sunday, July 18, 2010 12:23 PM
  • hi koalacatcher,

    these types of threads sometimes end up as a mess because each likes their own language and think theirs is better than the other.  this happens a lot so expect to get some strange posts here.

    about your needs though:

    both c# and vb.net will require the .net framework, so doesn't matter which one you choose as far as the framework is converned.

    which one you should choose will be a matter of many things.  vb may be easier to learn at first for whomever you will have doing the work because it reads more like natural english more than c#.  c# is a little more to the point.  but basically it's all the same in the end if you can write descriptive code.  but to start, it is easier for many to learn vb.net.

    i don't think at this point that you can find too many differences (if any) in ability between c# and vb.net.  they are developing both side by side now so what is in one will be in the other.

    c# is not as manged as vb.net, meaning that while you type code, vb will correct a lot for your and assume things.  this can be a plus and help you be more productive.  however, it can also make you lazy because you begin to rely on it doing things correctly when you don't have to.  not a big deal i guess, you have to play with both to understand what i mean.

    what i have seen lately though is that vb.net is in demand for many businesses.  i see a lot of vb.net employment ads and not that many c# any more.  in my area at least.

    if you are new to development and want to have some hands on with the project yourself i might suggest you go with vb.net first to be sure you can follow along with whomever is developing it for you.  but you can learn c# as well.  really it comes down to you and what you want i guess.  have to talked to the developer who will create the application for you to get their input?  seems there are many things to consider here, but in the end you may just need to choose one.

    i personally started with vb.net because i knew vb developers and that's i ever heard about before i ever started.  just seemed like the way to go.  and i didn't really understand c# when first looking at it.  vb.net was easier to pick up at first for me.  now i have a good understanding of c#.  but if i would have focused more on c#, i probably would have picked it up quickly as well.

    well, i hope this has helped.  maybe if there are more details about your project and situation you can give, maybe there are some other things to consider that we can suggest one way or the other..  basically either one will get the job done and can be easily moved from desktop applications to web or office.  vba is vb though, so that may be something to consider if somehow you need to tie in office development outside of visual studio as well.  many things to consider.


    FREE
    DEVELOPER TOOLS     CODE     PROJECTS

    DATABASE CODE GENERATOR
    DATABASE / GENERAL  APPLICATION TUTORIAL
    Upload Projects to share or get help on and post the generated links here in the forum
    www.srsoft.us
    Sunday, July 18, 2010 1:55 PM
  • On 7/18/2010 9:55 AM, Jeff - www.SRSoft.us wrote:
    > hi koalacatcher,
    >
     
    snipped>
     
    Do you want to know the real difference between VB and C#.NET
    professionally? It's about a $10,000 difference in pay yearly between
    the two on C#'s side.
     
    Sunday, July 18, 2010 2:27 PM
  • This is not a trolling or stupid question. OP want to know which language to choose between VB.NET and C# that does not require .net framework.

    kaymaf


    CODE CONVERTER SITE

    http://www.carlosag.net/Tools/CodeTranslator/.

    http://www.developerfusion.com/tools/convert/csharp-to-vb/.

    Sunday, July 18, 2010 2:37 PM
  • This is not a trolling or stupid question. OP want to know which language to choose between VB.NET and C# that does not require .net framework.

    kaymaf


    CODE CONVERTER SITE

    http://www.carlosag.net/Tools/CodeTranslator/.

    http://www.developerfusion.com/tools/convert/csharp-to-vb/.

    Kaymaf,

    I did not know that you did not know that. Every Microsoft .Net application needs a framework.

    A question with which about 60% of the trolling messages in Net newsgroups and forums start

    The second one is about 35%=: What is better VB or C#. 


    Success
    Cor
    Sunday, July 18, 2010 3:27 PM
  • On 7/18/2010 9:55 AM, Jeff - www.SRSoft.us wrote:
    > hi koalacatcher,
    >
     
    snipped>
     
    Do you want to know the real difference between VB and C#.NET
    professionally? It's about a $10,000 difference in pay yearly between
    the two on C#'s side.
     


    It is not clear for me, what can Koalacatcher take then better, a C# developer or a VB.Net developer as it is like you wrote?

     


    Success
    Cor
    Sunday, July 18, 2010 3:31 PM
  • On 7/18/2010 11:31 AM, Cor Ligthert wrote:
    > On 7/18/2010 9:55 AM, Jeff - www.SRSoft.us wrote:
    > > hi koalacatcher,
    > >
    > snipped>
    > Do you want to know the real difference between VB and C#.NET
    > professionally? It's about a $10,000 difference in pay yearly between
    > the two on C#'s side.
    >
    >
    > It is not clear for me, what can Koalacatcher take then better, a C#
    > developer or a VB.Net developer as it is like you wrote?
    >
     
    I don't know what you're talking about, and I don't think yo do either.
     
    You're wasting my time here.
     
    Mr. Arnold
     
    Sunday, July 18, 2010 3:55 PM
  • On 7/18/2010 11:31 AM, Cor Ligthert wrote:
    > On 7/18/2010 9:55 AM, Jeff - www.SRSoft.us wrote:
    > > hi koalacatcher,
    > >
    > snipped>
    > Do you want to know the real difference between VB and C#.NET
    > professionally? It's about a $10,000 difference in pay yearly between
    > the two on C#'s side.
    >
    >
    > It is not clear for me, what can Koalacatcher take then better, a C#
    > developer or a VB.Net developer as it is like you wrote?
    >
     
    I don't know what you're talking about, and I don't think yo do either.
     
    You're wasting my time here.
     
    Mr. Arnold
     

    This is actually exactly why so many people say, "Don't ask questions like this; it marks a troll and where the OP isn't the troll it attracts trolls like honey draws ants."  darnold92 really blatantly loves honey.

    Here in the real world where work actually gets done for actual monetary compensation, developers choose Visual Basic for one reason and one reason only: It's the programming equivalent to the Leatherman Pocket Multitool. Visual Basic (for Applications) is employed in the MS Office Object Model (from Office 2000 up to and including the new 2010. Visual Basic (for Applications) is employed in the ArcGIS software suite API. VBA is embedded in dozens of other high-end and industry-specific software products for built-in extensibility as well. Visual Basic is employed in Windows Scripting Host (WSH/wscript) and the Command-Based Scripting Host (cscript), and VBScript is processed/executed in HTML markup by all webbrowsers worth having. In Legacy Visual Basic (6 and earlier) VB also exposed OOP, and in DotNET VB exposes OOP plus DotNET. The syntaxes, array functions, and other basic language behaviors are absolutely identical across these multiple and various platforms meaning that if you VB then you do all of the above. If you're a Visual Basic developer, all of the above is right at your fingertips as long as you're willing/able to learn the variant engine capabilities.

    C# doesn't offer half of this. In fact, C# only offers DotNET. C# is however, as others have mentioned, an internationally standardized syntax as opposed to a company proprietary language. C# also enjoys an avid following in non-DotNET circles, with multiple interpreters available for Linux/Unix; if you develop on DotNET with C# though, you're as tied to Windows with DotNET as you would be with Visual Basic. There is a (allegedly functional) product called Mono to extend DotNET onto Linux/Mac platforms, but Mono sucks hard and loud; many proponents will screech that it's VB that sucks and therefore the Mono project doesn't support it as well as C#, but if you've ever actually tried to use Mono you'd have learnt really fast that System.Windows.Forms doesn't work well in Mono in any language and System.Net.Security is almost entirely nonexistent (at least if you want/need to work with any SSL over 1.0 and/or use any crypto newer than 10 years old).

    On the whole "$10,000.00 USD per year" question, because the VB developer can literally do anything the C# developer can do and then a whole lot more, the VB developer gets to write his/her own ticket (very, very literally) when working with/for anybody who relies on Microsoft Products like Windows, MS Office, (and ESRI products, and other VBA-embedded products). The C# developer without any ability to do anything but prattle nonsense about how lowly and worthless VB skills are, on the other hand, literally can't do anything but weigh in heavily on topics he/she knows little/nothing about and then say nasty things like, "I don't know what you're talking about and I don't think you do either," when they get called on it.

    So in the end, you should never, never, never select a programming language for any development based on which language is better than another; you should find a competent developer who can tell you his/her own reasons for preferring one language over the other and then let them do it their own way because that way you'll get the best possible final product out of them.

    You should also change this thread to a Discussion type.


    It never hurts to try. In a worst case scenario, you'll learn from it.
    Sunday, July 18, 2010 7:10 PM
  • If he/she start telling techincal differences, then you have to do with an amateur and you can better take somebody else (with the exception currently if you want to develop for mobile 7).

    Except Cor, there are are very real technical differences between C# and VB.NET - even now.  They have achieved a lot more parity in v10, but they are still not completely equal...

    For instance, VB.NET does not have built in support for custom iterators.  This is a huge mark agains VB.NET, IMHO - especially in todays linqified world where IEnumerable implementations become much more important.

    C# does not have in line xml.  VB.NET does not have the ability to work with unsafe code.  C# does not support as many linq keywords.  VB.NET has a really lame implementation of auto implemented properties (a feature copied poorly from C#).

    I could go on. 

    Personally, I agree that at the end of the day it does come down to personal choice.  But, you can't say that there are no technical differences between the languages.  Or am I an amateur?


    Tom Shelton
    Sunday, July 18, 2010 8:40 PM
  • You put this in a trolling thread, the number one program language for Microsoft is Visual Basic for Net and second C++

    Actually, I don't believe that's true, Cor.  C# places ahead of VB.NET in most surveys I've seen - including TIOBE.  But, even my personal experience seems to indicate there are more C# opportunities then VB.NET.  I am pretty well fluent in both, yet all my job offers and contracts end up using C#....  None of the members of our local .NET user group use VB.NET - though one uses Delphi Prism (the Delphi for .net).

     

    Also you wrote about controlled by ISO and ECMA, which says nothing. Controlled by boards means mostly less progress.

    LOL...  You realize that almost all of the new VB.NET features in v10 were copied from C#3 right ?  And most of them poorly.


    Tom Shelton
    Sunday, July 18, 2010 8:50 PM
  • Jeff,

    From a newbie perspective, I'm not sure either one would be easier or harder to grasp.  Syntax in general is easy - the hard parts of programming are concepts such as logical structures, algorithms, and OOP concepts.  And of course, learning the framework.  Personally, I don't think VB has an advantage in any of these areas.

    Also, just so you know C# has had background compilation since VS2008 sp1.  Though, it doesn't seem to bog down the IDE as VB's does on large projects.  Of course, I would expect that since, IMHO, the C# IDE experience has been vastly superior to the VB experience since at least VS2005.

     

     


    Tom Shelton
    Sunday, July 18, 2010 8:57 PM
  • I think you'll find that the main reason for that is that most C# developers I know come from a C++ background, and are in general better trained and more experienced then their VB counterparts - rather then in any technical difference between the two languages.

    Tom Shelton
    Sunday, July 18, 2010 8:58 PM
  • You put this in a trolling thread, the number one program language for Microsoft is Visual Basic for Net and second C++

    Actually, I don't believe that's true, Cor.  C# places ahead of VB.NET in most surveys I've seen - including TIOBE.  But, even my personal experience seems to indicate there are more C# opportunities then VB.NET.  I am pretty well fluent in both, yet all my job offers and contracts end up using C#....  None of the members of our local .NET user group use VB.NET - though one uses Delphi Prism (the Delphi for .net).

    I could say the exact same about VB, Tom. If I did though, I'd at least be honest enough to mention that the client's decision to settle on VB was heavily influenced by my recommendations.

    For example, I don't believe for one second that anyone came to you already saying, "I want my Windows Application project done in C#.NET," where the person saying it had even the slightest comprehension that DotNET was involved or even that it exists where VB and C# are concerned, or how VB and C# are actually related through DotNET.

     

    Also you wrote about controlled by ISO and ECMA, which says nothing. Controlled by boards means mostly less progress.

    LOL...  You realize that almost all of the new VB.NET features in v10 were copied from C#3 right ?  And most of them poorly.


    Tom Shelton

    Are you pointing out C#'s actual forward progress, or that VB is keeping up with its progress pretty neatly? :-)
    It never hurts to try. In a worst case scenario, you'll learn from it.
    Sunday, July 18, 2010 8:59 PM
  • Thanks very much guys, an interesting discussion ;)

     

    My developer says pretty much the same, he prefers C# but they will both result in the same application quality. Contrary to that, I've actually decided to go with VB.NET as I have some experience with that.

     

    Thanks! :)

    Sunday, July 18, 2010 9:11 PM
  • Andrew,

    That is the biggest troll post I have ever seen...

    Yes, the use of VBA is prominent - but, please - VB.NET is not VBA or even close to it.  About the only place were you can get resonable office functionality with VB.NET is using VSTO - and C# can do that as well.  And last I looked, VBScript was supported by only one web browser - and that is IE.  A browser that is known far and wide to be loosing market share and sinking like a rock because it sucks so badely.

    As for WSH - in case you haven't noticed, that 1) is turned of in many corporate environments because of it's inherit insecurity and 2) is being phased out in favor of PowerShell.

    Also, you comments about Mono are profoundly ignorant.  I have used and do use mono on Linux.  And, your comments about system.windows.forms are completely off base.  About the only things that can cause you issues with winforms is subclassing (and even that works most of the time unless you call windows api's) or use of COM components - Mono doesn't support COM.

    C# developers are often paid more - the main reason is usually C# developers come from more technical backgrounds or have more experience then VB developers.  The difference has little to do with the languages, but more to do with the average quality of the developers, IMHO.

    I do agree with your last paragraph though.  C# and VB.NET are in general functionally equivalent in the hands of a quality developer - though, I tend to prefer C# because the IDE is way more functional and I personally prefer C-style syntax.


    Tom Shelton
    Sunday, July 18, 2010 9:13 PM
  • Andrew,

    That is the biggest troll post I have ever seen...

    Yes, the use of VBA is prominent - but, please - VB.NET is not VBA or even close to it.  About the only place were you can get resonable office functionality with VB.NET is using VSTO - and C# can do that as well.  And last I looked, VBScript was supported by only one web browser - and that is IE.  A browser that is known far and wide to be loosing market share and sinking like a rock because it sucks so badely.

    As for WSH - in case you haven't noticed, that 1) is turned of in many corporate environments because of it's inherit insecurity and 2) is being phased out in favor of PowerShell.

    Also, you comments about Mono are profoundly ignorant.  I have used and do use mono on Linux.  And, your comments about system.windows.forms are completely off base.  About the only things that can cause you issues with winforms is subclassing (and even that works most of the time unless you call windows api's) or use of COM components - Mono doesn't support COM.

    Read a white paper before you make ignorant personal attacks again, Tom. For your own sake if not for everyone else's.

    VB is in fact VB. It's a syntax. The syntax is overlaid on the for Applications engine in Office, the syntax is overlaid on WSH, and the syntax is overlaid on DotNET. The syntax for VB isn't even too different between Legacy and DotNET; it's the underlying calls to the runtime engine that are night and day. And the built-in COM Interop for Office Extensibility was the best thing available for Office a year before VSTO and it's still the best thing available - and it's totally exposable to DotNET in any language; at that point, bub, there's still a built in VBA IDE for coding directly in Office apps without meddling with the DotNET Framework or even the COM Interop.

    WSH hasn't been considered "insecure" since Win9x. In fact it wasn't "inherently insecure" at that point either; the real problem under Win9x was that somebody at Microsoft came up with the dumb idea that WSH should be installed and activated by default while 80% or more of Win9x users didn't even know what it was; this was a security risk because nobody had any clue that it was even there and a handful of irresponsible scripters used it to do damage.  Again, white paper isn't just for rolling dope and sleeving old Beatles LPs.

    I really think you're confusing IE with Netscape on the whole market share thing. VBScript is supported in all available browsers (including the ones the original developers were too lazy to work it in for) via additional plugins, and once again by any browser worth having.

    Have you ever actually worked with Mono? Because I have, and it sucks. That's the voice of long experience, most of which ended in crying and ripping at hair by the handfuls. If you love Mono so much and want me to change my attitude toward the hunk of ____, then go get your hands on the sourcecode and fix everything that's wrong with it. Mono is good for absolutely nothing but hosting really significantly low-end ASP.NET sites in Apache; all of what's there for real desktop application development is either grossly underdeveloped, grossly underdocumented, or developed and documented but only functional in the kind of general way that an old rag is functional as a gas cap.
    It never hurts to try. In a worst case scenario, you'll learn from it.
    Sunday, July 18, 2010 9:33 PM
  • This is not a trolling or stupid question. OP want to know which language to choose between VB.NET and C# that does not require .net framework.

    kaymaf


    CODE CONVERTER SITE

    http://www.carlosag.net/Tools/CodeTranslator/.

    http://www.developerfusion.com/tools/convert/csharp-to-vb/.

    Kaymaf,

    I did not know that you did not know that. Every Microsoft .Net application needs a framework.

    A question with which about 60% of the trolling messages in Net newsgroups and forums start

    The second one is about 35%=: What is better VB or C#. 


    Success
    Cor

    @ Cor
    I still repeat my statement, this is not trolling or stupid question. Stupid question is the one that nobody ask.  if OP doesn't understand that C# run on .net framework that does not prevent him/her from asking.

    Is funny if you think i dont know that .net application requires .net framework. I use both C# and VB.NET 

    And OP doesn't care about the difference between C# and VB.NET, based on this previous thread http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/bd08f6ff-c090-409d-83fd-3fb3ea6deb75. OP just want a language that is not depends on .NET framework

    kaymaf


    CODE CONVERTER SITE

    http://www.carlosag.net/Tools/CodeTranslator/.

    http://www.developerfusion.com/tools/convert/csharp-to-vb/.

    Sunday, July 18, 2010 9:37 PM
  • I could say the exact same about VB, Tom. If I did though, I'd at least be honest enough to mention that the client's decision to settle on VB was heavily influenced by my recommendations.

    For example, I don't believe for one second that anyone came to you already saying, "I want my Windows Application project done in C#.NET," where the person saying it had even the slightest comprehension that DotNET was involved or even that it exists where VB and C# are concerned, or how VB and C# are actually related through DotNET.

    From my latest job offer:

    Required Skills: 
    1) Strong .NET 3.x, WCF, C# skills, SQL Server desirable 
    2) 4+ years of experience in industry in writing solid production quality code 
    3) Solid understanding of Object Oriented Programming
    4) Knowledge of distributed systems will be very helpful. 
    5) Smart & Great Problem Solving skills

    Notice the skills section.  I very rarely have offers specifying VB.NET.

    Still, the point is that most of the opportunities I see involve C# over VB.NET.  Search monster.  You'll find that there are roughly twice as many jobs specifying C# as you will VB.NET.  And how do you explain the lack of VB developers in a .NET users group?  Like I said the only non-C# guy is a Delphi Prism programmer....  Or the fact, that most surveys place C# usage greater then VB.NEt?

    Contracting is a bit different - because I rarely have any tech stack specified in a contract job.  I gravitate towards C# and .NET for these because of personal preference - but, I could just as easily use VB.NET.  So, I'll concede that when a language or tech stack is specified - it's almost always C# over VB.NET :)

     

     

    Are you pointing out C#'s actual forward progress, or that VB is keeping up with its progress pretty neatly? :-)

    Actually, I'm pointing out C# is actually progressing faster then VB.NET - and that most of VB.NET's latest features are POORLY copied imitations of C# features.  For instance, in VB.NET you can't specify different accessibility for the get and set procedure in auto implement properites.  And you can directly access the backing field.

    Don't get the impression I dislike VB - I like it fine.  I prefer C# for most things because I rather enjoy C-style syntax and the C# IDE is very much superior to the VB one....

     


    Tom Shelton
    Sunday, July 18, 2010 10:07 PM

  • Are you pointing out C#'s actual forward progress, or that VB is keeping up with its progress pretty neatly? :-)

    Actually, I'm pointing out C# is actually progressing faster then VB.NET - and that most of VB.NET's latest features are POORLY copied imitations of C# features.  For instance, in VB.NET you can't specify different accessibility for the get and set procedure.  And you can directly access the backing field.

    Don't get the impression I dislike VB - I like it fine.  I prefer C# for most things because I rather enjoy C-style syntax and the C# IDE is very much superior to the VB one....

     


    Tom Shelton

    I've always felt that C# was far more Java-Like than C-Like. Ignorant me, I guess.

    Beyond that, you seem to be saying that because VB raises errors when you try something like this:
        Private ReadOnly Property Test1() As System.String
          Get
            Return mytest
          End Get
        End Property
        Public WriteOnly Property Test1() As System.String
          Set(ByVal value As System.String)
            mytest = value
          End Set
        End Property
    

    it is somehow inferior to a language that allows you to do something monumentally ill-advised in any scenario.

    "Just because you can doesn't mean you should." You can quote me on that. I bet you hate the police too; always telling you not to drive too fast, always telling you not to steal, always telling you not to put the gun in your mouth...
    It never hurts to try. In a worst case scenario, you'll learn from it.
    Sunday, July 18, 2010 10:19 PM
  • Edit: This is a serious predicament, I am paying somebody to develop a program for my company, and I need to chose VB.Net or C#.

    Then your choice will be dictated by the language that is used by the developer you choose.   That language should be one of many criteria you use to select the developer, and it is not a particularly significant one.   If you have no continuing relationship with a developer, then choose one that people you trust can recommend, and that meets other requirements such as price, responsiveness, commitment to quality standards and ongoing support.   Then ask them what language they develop in, and why. 

     

    Sunday, July 18, 2010 10:31 PM
  • Andrew,

    I'm not going to adress every point but:

    VB.CLASSIC syntax vs VB.NET SYNTAX - while there are lots of similarities, there are many, many differences as well.  Why do you think these arguments still rage in the VB.CLASSIC community.  For instance, what of the commonly used array construct used in VB.CLASSIC:

    Dim a(1 to 10) As Integer

    Non-zero lower bounds are no longer supported.  What about VarPtr, ObjPtr, and StrPtr?  What about GoSub/Return, etc, etc, etc.

    VBScript is not natively supported by any browser then IE - that's why it is almost universally shunned on the web proper.  javascript (or more properly ecma script) is the defacto web standard.  I would call you crazy to use VBScript in any public facing website.

    WSH is a hit or miss propostion, and is being phazed out in favor of PowerShell.

    As for Mono - yes, I use Mono quite often.  Apparently, you haven't used it for a while.  Generally, the choice of graphical environment in mono is not winforms, but Gtk# - though, Winforms does work pretty well now for most scenarios - and has for a while.  Gtk# is a cross platform ui library and it works perfectly with mono. 

    People have difficulties have a hard time understanding cross platform developement.  They are generally the people that call lots of windows specific api's (p/invoke) or they use hardcoded paths or line termination characters. 

    A few of the most popular Linux destop apps today are written in C#/Mono - Tomboy, FSpot, Banshee are just a few examples.

    I am not familar with mono's asp.net support, as I have never attempted to really use it.  But, it's support for server and desktop apps is very good.

    As for mono's support for VB - it's getting there.  The newest compiler is mostly feature complete, not supporting Option Explicit Off and not supporting XML comments.  The new vb compiler and it's run time library are written in vb - so, they are definitely making progress in that regard.

     


    Tom Shelton
    Sunday, July 18, 2010 10:32 PM
  • Actually, I was referring to auto implement properties....  I will now edit my post to make that clearer.
    Tom Shelton
    Sunday, July 18, 2010 10:34 PM
  • I've always felt that C# was far more Java-Like than C-Like. Ignorant me, I guess.

    Java, C#, JavaScript all are based on C++. C++ is based on C. All share many syntactical similarities - All are considered part of the C language family

    What I was referring too was auto implemented properties...  For instance, in C# we can write:

    class TheClass
    {
     public int Age { get; private set;}
    }
    

     

    VB.NET require that the get and set accesor have the same visibility, which greatly reduces their usefulness.  I can't tell you how often I use the above construct.  Also, vb.net would generate a field _age that would be accessible from your code allowing you to bypass the property.  I don't personally like that, but I will admit this is a style preference rather then a flaw.

    The only nice thing about VB.NET's implementation of auto generated properties is that you can assign a default value in the declaration:

     

    Class TheClass
     Public Property Age As Integer = 20
    End Class
    

     


    Tom Shelton
    Sunday, July 18, 2010 10:47 PM
  • I'm agree with Acamar.

    Language is just a tool, long as long your man can use and love it. 

    You work will be success.

    Sunday, July 18, 2010 10:56 PM
  • I agree that in general, it is the artist and not the brush that makes a good program :)

    Tom Shelton
    Sunday, July 18, 2010 10:57 PM
  • For instance, VB.NET does not have built in support for custom iterators.
    This is a huge mark agains VB.NET, IMHO - especially in todays linqified world where IEnumerable implementations become much more important.

    C# does not have in line xml.  VB.NET does not have the ability to work with unsafe code.

    Tom Shelton

    Hi Tom,

    Purely out of curiosity, would you care to add a page or a blog-page on your website or elsewhere detailing custom iterators with a short example in Visual C# and support your statement?

    Could you do the same about unsafe code as well please?

    You could maybe add a post in the Visual C# forums and add a link here?

    ________________________________________________________________

     

    By the way, I have not looked at and I do not know the job situation in the USA, but I feel the situation in the U.K. is more biased towards Visual C# software developers in the job market. However, I feel unbiased in the old

    VisualBasic.Net Vs Visual C# Vs Visual C++

    as each language has its merits. Additionally, it is always a bonus to know 2 or more .Net languages and be able to manually translate between them, especially for a professional software developer.  :-)


    Regards, John
    Sunday, July 18, 2010 11:03 PM
  • Andrew - do a little research, it is a well documented fact that C# developers command higher salaries on average then VB.NET programmers.

    So, whether or not his comment was "irrelevant", it wasn't "void of anything resembling knowledge of or experience in the industry you're babbling about."   Mainly, I see you and cor as the ones acting as VB.NET cheerleaders, expressing off the wall opinions that do not reflect the industry in general.


    Tom Shelton
    Monday, July 19, 2010 12:06 AM
  • To any moderator,

    Can you please lock this thread before it turns into a very heated discussion or debate?

    Monday, July 19, 2010 12:11 AM
  • Andrew - do a little research, it is a well documented fact that C# developers command higher salaries on average then VB.NET programmers.

    So, whether or not his comment was "irrelevant", it wasn't "void of anything resembling knowledge of or experience in the industry you're babbling about."   Mainly, I see you and cor as the ones acting as VB.NET cheerleaders, expressing off the wall opinions that do not reflect the industry in general.


    Tom Shelton

    There's nobody actually in the technology industry who only does one trick, whether that trick is VB or C# or C++ - point in fact there's nobody actually in the technology industry whose only skill is programming, no matter what language or platform they do it on.  That means there's nobody in the industry who makes $10,000.00 USD more per year or even per lifetime than anybody else on the strict, sole, and explicit basis of the one language they can program in.

    That includes freelancers like you.  Sorry to burst your bubble, bub.


    It never hurts to try. In a worst case scenario, you'll learn from it.
    Monday, July 19, 2010 12:19 AM
  • Yes, C# needs a CRL the same way basic does.

    Cor, thanks for having said that.

    Renee

    Monday, July 19, 2010 12:45 AM
  • i have actually seen the opposite of what Tom has in my area.  vb.net seems to be the majority of job requirements, and sql server.  of course web is a big one but i see vb.net more than c#.  the difference is quite noticeable in the recent years.

    i think there may also be a small shortage of vb.net developers or maybe hesitant ones as well because i actually saw an ad that specifically noted that c# was not required.  i found it interesting that it was made a very clear point that c# was not required.

    i used to really want to pursue c# more because of the demand for it, but now i am not so sure it will ever be a requirement for me to work.  i still want to learn it fully, but again, not for work so much, because i want to.

    a project i am considering working on is for a large company and they have been searching for vb.net developers for a while now.  i will be number 3 (if i take it) in a 5 person team, with 2 already on board, if they can find 2 more.  their staffing company has actually had to hire other staffing companies to find them.  it's a web project with oracle back end, so not sure how much that plays a part in the search being slow.


    FREE
    DEVELOPER TOOLS     CODE     PROJECTS

    DATABASE CODE GENERATOR
    DATABASE / GENERAL  APPLICATION TUTORIAL
    Upload Projects to share or get help on and post the generated links here in the forum
    www.srsoft.us
    Monday, July 19, 2010 12:51 AM
  • Andrew - despite your protests, you might want to make use of your favorite search engine before you continue this argument.  Fact, C# jobs pay more on average the VB.NET jobs - but, it should be noted that gap has been decreasing over the last few years.  In 2003 it was about a 26% differential - C# favor.

    And for your information, Bub - I have a regular paying job.  I am not a "freelancer" - though, I do contract work on the side occasionally :)


    Tom Shelton
    Monday, July 19, 2010 12:57 AM
  • Jeff, both our regional experiences aside, a quick monster.com search reveals about twice as many jobs requiring C# then VB.NET....

     


    Tom Shelton
    Monday, July 19, 2010 1:04 AM
  • Tom,

    i haven't looked but i suspect you are right about monster.

    my next question would be: why are there so many jobs for c#?  are there not enough c# developers anymore?  or is there a shortage of developers as a whole?

    i know there is a consistent growth of developers here every day.  so what is happening?

    i haven't looked at the numbers in the vb versus c# forums in some time, but some time back i looked and vb was increasing steadily over c#.

    maybe too many are going to vb.net to start.  not sure.

    i guess there are a lot of factors as to why there are that many c# jobs available now.


    FREE
    DEVELOPER TOOLS     CODE     PROJECTS

    DATABASE CODE GENERATOR
    DATABASE / GENERAL  APPLICATION TUTORIAL
    Upload Projects to share or get help on and post the generated links here in the forum
    www.srsoft.us
    Monday, July 19, 2010 1:23 AM
  • Andrew is not a troll, no matter how hard you try to make one him.

    Renee

    Monday, July 19, 2010 1:25 AM
  • On 7/18/2010 9:04 PM, Tom Shelton wrote:
    > Jeff, both our regional experiences aside, a quick monster.com search
    > reveals about twice as many jobs requiring C# then VB.NET....
    >
     
    You can do a search on Dice.com that will show the same thing across the
    US. I have nothing against VB.NET. I cut my eye teeth on the MS platform
    using VB. And I have a couple of contract opportunities here recently to
    use my VB 6 and VB.NET skill-sets again.
     
    And I'll continue to use my C#.NET skill-set as well. Being a contractor
    is different than being a full-time developer for a company. You have to
    have more than one skill-set as a contractor and not limit yourself.
     
    But the facts are that there are more C# .NET job opportunities than VB.NET.
     
    Monday, July 19, 2010 1:41 AM
  • some of the small contract work i have been doing lately is vba.  i never thought i would go back to vba, but here i am.

    i think the best case to make here is to learn all the languages.  can't hurt.  :-)

    the jack of all trades might come out better than the master of one.  but i guess that really depends on the trade you master vanishing at some point.  basically, leave yourself open to many options.

    i never came into programming with the idea that i wanted to learn vb.net because of the money.  first and foremost, i wanted to learn programming and vb was my ticket in.  if demand, and not enjoyment, is the driving force behind your learning something, it almost seems pointless.


    FREE
    DEVELOPER TOOLS     CODE     PROJECTS

    DATABASE CODE GENERATOR
    DATABASE / GENERAL  APPLICATION TUTORIAL
    Upload Projects to share or get help on and post the generated links here in the forum
    www.srsoft.us
    Monday, July 19, 2010 1:50 AM
  • His post was designed to be inflammatory and contained many provably false statements.

    The C# developer without any ability to do anything but prattle nonsense about how lowly and worthless VB skills are, on the other hand, literally can't do anything but weigh in heavily on topics he/she knows little/nothing about and then say nasty things like, "I don't know what you're talking about and I don't think you do either," when they get called on it.

    I call that trollish.


    Tom Shelton
    Monday, July 19, 2010 2:04 AM
  • His post was designed to be inflammatory and contained many provably false statements.

    The C# developer without any ability to do anything but prattle nonsense about how lowly and worthless VB skills are, on the other hand, literally can't do anything but weigh in heavily on topics he/she knows little/nothing about and then say nasty things like, "I don't know what you're talking about and I don't think you do either," when they get called on it.

    I call that trollish.


    Tom Shelton


    So do most of yours, Tom.

    At least I was actually responding to someone who was actually doing exactly what I said; your responses are nothing but emotionality spilling over with plenty of thoughtless diatribe and personal assault to go along with it.

    Or to put it another way:  Pot, meet kettle.

    Either way, grow up.


    It never hurts to try. In a worst case scenario, you'll learn from it.
    Monday, July 19, 2010 2:08 AM
  • Jeff,

    It's hard to say, but I do see that there is significantly more demand for C# skills then VB.NET on a nation wide scale.  Why?  I don't know.


    Tom Shelton
    Monday, July 19, 2010 2:08 AM
  • On 7/18/2010 9:23 PM, Jeff - www.SRSoft.us wrote:
    > Tom,
    >
    > i haven't looked but i suspect you are right about monster.
    >
    > my next question would be: why are there so many jobs for c#? are there
    > not enough c# developers anymore? or is there a shortage of developers
    > as a whole?
     
    The push now is about OOP and SOA in enterprise level development
    architecture, which has been around for years in the Java wrold.
     
    This was brought on by MS introducing and pushing in that direction with
    Linq, List<T>, ORMs like Link-2-SQL and ADO.NET Entity Framework, WCF,
    WPF, Silverlight DDD, TDD, n-tier development and the expertise lies
    with C# developers who are the ones using this technology.
     
    And companies are looking for the expertise. VB.NET developers have yet
    to catch-up with this, and they are still talking about datasets,
    datatables and nothing about OOP, DDD or TDD. As a matter of fact, a lot
    of C# developers have not caught up to it either.
     
    >
    > i know there is a consistent growth of developers here every day. so
    > what is happening?
     
    Maybe, it's due to the hobbyist that find VB more easy to use than C#.
    >
    > i haven't looked at the numbers in the vb versus c# forums in some time,
    > but some time back i looked and vb was increasing steadily over c#.
     
    I have not seen this from a professional level.
     
     
    Monday, July 19, 2010 2:17 AM

  • Quote from the OPs' 4th post in this thread:

    Thanks very much guys, an interesting discussion ;)

     

    My developer says pretty much the same, he prefers C# but they will both result in the same application quality.

    Contrary to that, I've actually decided to go with VB.NET as I have some experience with that.

     

    Thanks! :)

    Hi ALL,

    I do not know if some of you missed it but the OP koalacatcher has stated;

    "I've actually decided to go with Vb.Net ...."

    I would have proposed that post as answer, if the thread was not a discussion, as the OP has decided already. :-)

    So I hope this discussion does not need to continue much further. ;-)

     


    Regards, John
    Monday, July 19, 2010 2:31 AM
  • On 7/18/2010 10:31 PM, John Anthony Oliver wrote:
    >
    > Quote from the OPs' 4th post in this thread:
    >
    > Thanks very much guys, an interesting discussion ;)
    >
    > My developer says pretty much the same, he prefers C# but they will
    > both result in the same application quality.
    >
    > Contrary to that, I've actually decided to go with VB.NET as I have
    > some experience with that.
    >
    > Thanks! :)
    >
    > Hi ALL,
    >
    > I do not know if some of you missed it but the OP *koalacatcher*
    > <http://social.msdn.microsoft.com/Profile/en-US/?user=koalacatcher&referrer=http%3a%2f%2fsocial.msdn.microsoft.com%2fForums%2fen-US%2fvbgeneral%2fthread%2f7c79cf05-7c7b-4558-b678-e426fdad1214&rh=D0z%2bQag1khUybciTdKh8C0ULkFNqd9G1rjLns7cnW4k%3d&sp=forums>*
    > *has stated;
    >
    > *"I've actually decided to go with Vb.Net ...."*
    >
    > I would have proposed that post /as answer/, if the thread was not a
    > discussion, as the OP has decided already. :-)
    >
    > So I hope this discussion does not need to continue much further. ;-)
    >
    > ------------------------------------------------------------------------
    > Regards, John
     
    I am happy for the OP. He went to where his expertise lies. What he
    should have done is posted to a VB and C# forums, which I didn't see
    that as I frequent both. But, you do see where his developer wanted to
    go. I am not taking any mess from anyone, and if he or she doesn't like
    it, tough. :) Cor knows!
     
    Monday, July 19, 2010 3:02 AM
  • Me too...

    Tom Shelton
    Monday, July 19, 2010 3:03 AM
  • I'd like to have you point to one place where I have personally assaulted you... 

    I have no beef with you Andrew.  While, I may not agree with the tone of Mr. Arnolds response - I don't believe there are actually "stupid questions", the facts that Mr. Arnold stated are true, documented, facts.  You simply seem to refuse to do a few simple internet searches.

    I also take issue with the tone of Cor's posts - where he implies that there are no technical differences between languages, and anyone that says there are amateurs.  There are many technical differences - and there are even a couple of things that VB does better - but there is not reason to be insulting to others who prefer a different technology or pretend there are no differences between languages.

     


    Tom Shelton
    Monday, July 19, 2010 3:21 AM
  • John...

    A custom iterator is implemented in C# using the yield return statement.   It basically causes the compiler to generate and IEnumerable class that maintains state for you.  VB has nothing like this - so it is more work to implement.  This is normally achieved with two classes - an outer class that Implements IEnumerable(Of T) and a private nested class that implements IEnumerator.

    Here is a small C# extension method (also easier to implement in C#):

    public static IEnumerable<FileInfo> EnumerateFiles ( this DirectoryInfo target, string searchPattern )
    {
      string searchPath = Path.Combine ( target.FullName, searchPattern );
      NativeWin32.WIN32_FIND_DATA findData;
      using ( NativeWin32.SafeSearchHandle hFindFile = NativeWin32.FindFirstFile ( searchPath, out findData ) )
      {
        if ( !hFindFile.IsInvalid )
        {
          do
          {
            if ( ( findData.dwFileAttributes & FileAttributes.Directory ) == 0 && findData.cFileName != "." && findData.cFileName != ".." )
            {
              yield return new FileInfo ( Path.Combine ( target.FullName, findData.cFileName ) );
             }
           } while ( NativeWin32.FindNextFile ( hFindFile, out findData ) );
         }
       }
    
    }
    

    In C#, an extension method is simply a member of a static class that uses the this keyword in it's parameter list.  The yield return is what actually causes the compiler to generate the IEnumerable/IEnumerator class pair.  Basically making it much less code in C# then I would have had to write if it were VB.NET.  Not that it would be impossible in VB.NET - just more code.

    You can see the complete example here .  But the short story here is that I was able to write code like this:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;
    using FireAnt.IO;
    
    namespace FileSystemEnumeratorDemo
    {
      class Program
      {
        static void Main ( string[] args )
        {
          string path = Environment.GetFolderPath ( Environment.SpecialFolder.MyDocuments );
          DirectoryInfo root = new DirectoryInfo ( path );
    
          // get all doc files created before Nov. 1st 2009
          var fileQuery = from fileInfo in root.EnumerateFiles ( "*.doc" ) 
                  where fileInfo.CreationTime.Date.CompareTo ( new DateTime ( 2009, 11, 1 ) ) == -1 
                  select fileInfo;
    
          foreach ( var fileInfo in fileQuery )
            Console.WriteLine ( fileInfo.Name );
        }
      }
    }
    
    

    In C# 3 before the release of Framework 4 - where these methods actually exist as part of the framework.

    Unsafe code is not something used all that often.  But, basically it in C# it is possible to use a limited subset of pointer functionality that you would find in C++ - basically, it lets you do some direct memory access inside the managed environment.  Some people mistakenly think that C# lets you create unmanaged code - this is not the case.  The correct term is unsafe, because the runtime can not verify the actions your are going to take - so the code needs to be explicitly marked unsafe a compiler switch set to allow it.  The canonical example of using unsafe code would be in accessing the bits in a bitmap.  C# can be much faster then VB.NET at image manipulation because it can directly access the bytes in the bitmap and does not have to use indirect methods from the Marshal class, etc.

     

     


    Tom Shelton
    Monday, July 19, 2010 3:42 AM
  •  

    some of the small contract work i have been doing lately is vba.  i never thought i would go back to vba, but here i am.

    i think the best case to make here is to learn all the languages.  can't hurt.  :-)

    the jack of all trades might come out better than the master of one.  but i guess that really depends on the trade you master vanishing at some point.  basically, leave yourself open to many options.

    my response ------------------------------------------------------------------------------------------------------------------

    It's always best to know when to hold them and when to fold them, when playing poker. The same applies the technology such as programming. One has to know when to go to the bleeding edge technology and continue. I learned that back in the 1980's

    ----------------------------------------------------------------------------------------------------------------------------------------------------- 

    i never came into programming with the idea that i wanted to learn vb.net because of the money.  first and foremost, i wanted to learn programming and vb was my ticket in.  if demand, and not enjoyment, is the driving force behind your learning something, it almost seems pointless.

    my response ---------------------------------------------------------------------------------------------------------

    I never came into programming either in 1980 and IT back in 1971. It was about what can I do with computers,  what can I do and have some fun and enjoy doing it.  Then I quickly learned  about why not have some fun, enjoy what you're doing and get PAID while doing it from some old-timers at the time in the field.

    Do you think I have not been doing this for 38+ years and not enjoying it? But while I am enjoying it, pay me for my expertise. There is nothing wrong with it, and if you do think there is something wrong with it, then you're fooling yourself.

     

    Monday, July 19, 2010 5:05 AM
  • Hi Tom,

    Thanks for your post. :-)

    Where is the FireAnt.IO namespace from?

    Maybe I should have started a new question on this.

    If I leave you a message in your BLOG on this page you can get back to me if you wish.

    Unfortunately, I am not proficient enough in Visual C# yet to understand all of your code without say individual code comments for each line.

    The short section above regarding FileSystemEnumeratorDemo was clear enough for me though. :-)

    Being used to BASIC and Vb.Net I tend to think in Vb.Net syntax, so my mind tries to manually convert each line of code. LOL!! :-)

    I will take your word for it on the rest of your post regarding bitmap bytes and so on.

     

    Best wishes and....


    Regards, John
    Monday, July 19, 2010 5:14 AM
  • Tom,

    I had given an answer on the itterator, but this thread is too long, in my idea illustrates the answer below more the reply which we get forever from C# developers as last one in a thread when they see that their real arguments don't fit about the differences between VB and C#.

    You wrote that C# developers are more wanted than VB developers. You did not write that C# developers are mostly educated at Universities and VB developers in practise. In our western world it easier for an HRM manager to find some body with a grade than to find somebody with qualities.

    But in fact with stating this, is all that you write that HRM managers decide about the quality of a tool. Is it not the common practise of most persons who have less knowledge in a certain area, they copy and past?

     


    Success
    Cor
    Monday, July 19, 2010 7:14 AM
  • I coded in VB and all it's variations for about 8 years but I only code in C# now. Sorry VB developers but C# is a better development language. Why would I say such a hurtful thing about your wonderful language especially considering a search of the forums will find numerous post where I say things to the contrary?

    Tool support. Too many of the tools necessary to build the developments 'ecosystem' are designed for C# lambda syntax.

    Coding in VB for me now feels like drawing with a big thick marker pen with my tongue sticking out the side of my mouth. Sure I may draw something that looks like a house, and I may even put it on the fridge door, but it's not an artistic masterpiece. It will never be elegant.  Elegant code? artistic? what the ____ is Derek talking about.... right?

    Sorry VB idevelopers, I love yous all but C# is a better language.

     

    Don't feed the trolls. Happy coding.

    Monday, July 19, 2010 9:53 AM
  • First of all I am from DEC which during the seventies, eighties, and nineties was the second largest computer company in the world and I was a priciple engineer in VMS engineering of which windows is a descendent. I was part of a massive anti-C culture and I'm glad because I hate C.

    Language is just a tool is what happens when you become so abstract that nothing is is useful. You've gone a long way towards removing all useful information. I know computers. I know bliss and VAX assembler and a couple of oyher languagues. I've done a little C programming, enough to know that I dont want to do any more.

    To the op. The author can also 'mix and match with DLL files. Overall your either going to have to rely on someone else to make your decision or (gasp) read.

    Renee

    Monday, July 19, 2010 10:37 AM
  • Hey Renee, I'm curious; was it the C { syntax } you hated?  What else did you hate about C? what do you luv about VB?

    To the original poster. Fact of the matter is your asking someone else to develop the software for you. Why is programming language used by this person a big deal? Truth of the matter is we (the peeps on this thread) have no idea what you want your application to do so, like yourself, we have no idea what language is the best to meet the requirements of the project. Example, perhaps it's a number cruncher where performance is of most important non-functional requirement... recommend FORTRAN yeah. Maybe the application needs to prcess TBs of information... Haskell. Maybe the application needs to update a database (or something like that), which is what we're probably all assuming, then....


    Point is you should be concentrating more on the requirements of the software you want; what you want the software to do....

    rather on the programming language.

     

    Oh right the original poster has choosen VB.NET. End of thread. Later peeps.

    Monday, July 19, 2010 11:59 AM
  • Derek,

    I've no favorite about Rembrandt or Van Gogh, but in general I find Rembrandt more the one I like.

    I'm just among those who want a job done as  quick as posible in a maintainable way.

    Visual  Basic fullfills that in most desktop applications very much.

    However, if I need to create for instance an application which is more around algabraic solutions, so needs short syntax, then I agree C# is a better choise.

    If I've to describe a little bit a process in code, than VB does that in my idea better.

    Take whatever program and see where more documentation is used between line of the code, you will probably see that it is more in C# than in VB.

    At the start of Net there was thought that VB did not need documentation, now C# and VB share the same system. Probably not because VB developers asked for that, but because C# evangelist (who I mean know it) used that as not being in VB so an advantage of C#.

    Things like that are also operator overloading, which I never saw asked in a newsgroup, then because it did not exist in C#.

    Now we see also an oposite direction as the dynamic keyword is created in C# to get more parity with VB.

    There is more than personal preference, but that does not say that one of the two is "Beter". I second what you wrote in your other message.


    Success
    Cor
    Monday, July 19, 2010 12:52 PM
  • I'm not sure of your points, Cor.  Operator overloading existed in C# from day one.  It did not exist in VB until 2005.


    Tom Shelton
    Monday, July 19, 2010 1:24 PM
  • I coded in VB and all it's variations for about 8 years but I only code in C# now. Sorry VB developers but C# is a better development language. Why would I say such a hurtful thing about your wonderful language especially considering a search of the forums will find numerous post where I say things to the contrary?

    Tool support. Too many of the tools necessary to build the developments 'ecosystem' are designed for C# lambda syntax.

    Coding in VB for me now feels like drawing with a big thick marker pen with my tongue sticking out the side of my mouth. Sure I may draw something that looks like a house, and I may even put it on the fridge door, but it's not an artistic masterpiece. It will never be elegant.  Elegant code? artistic? what the ____ is Derek talking about.... right?

    Sorry VB idevelopers, I love yous all but C# is a better language.

     

    Don't feed the trolls. Happy coding.

    Hi Derek,

    You are funny here mate. Did we all draw like that ( :-P ) as kids? LOL!!

    We all have kids masterpieces on fridge doors at some point don't we?    :-)

    Don't feed the Ogres either!! I went to see the latest Shrek film last week.    :-D

    Those DreamWorks and Pixar movies are a great examples of computer use in producing excellent animation.

     I was blown away by the software demos by Pixar staff at our local university, here in the U.K,

    just before Ratatouille was released.


    Regards, John
    Monday, July 19, 2010 1:49 PM
  • That was what I meant Tom, beside a certain discussion group which you know also, I never saw any question for overloading operator for VB. 

    This feature is from day one in C# but was added to VB, in my idea not that it was needed but always used before 2005 to tell that it was in C # and not in VB.

    In my idea where the generic lists, the option infer/var (I know we don't agree about that), Linq and more of those much more important for the VB developer than Operator overloading, but because it was not in VB it should be in VB.  If you really want to use operator overloading then you are probably more a C# type developer than a VB one. (Before you write it, operator overloading makes for me not that different in the languages like you maybe do) For me are the more automatic typing, automatic keywords, solving typos automaticly instead of endless error messages more the differences between C# and VB.

    Don't misunderstand, if I write a C# program, I write without thinking the semicolumns and the curly bracelets. I even after an hour write a procedure (), and a [] for a collection (One of the things I like more in C# than the () in VB for that.) While after a while C# I need about an hour to forget typing the semicolumn.

    :-)

    Cor


    Success
    Cor
    Monday, July 19, 2010 1:54 PM
  • You hit the problem, Derek. Only one thing is worse than poor code which is writing in C. It's the brackets and curly cues which are horrible to me. The DEC systems high level language was Bliss (a moment of silence - I named a dalmatian after it). Bliss also had brackets and curly cues. I spent the afternoon looking for missing curly-cue once. I got to be very good in bliss. But nothing, no nothing is worse than C. It is a case of the least of the evils. Basic is ok. I'd rather be programming in Bliss. But I will not program in C. (I don't think)

    Renee

    Monday, July 19, 2010 2:02 PM
  • i have mixed feelings about c#.

    on one hand i like how vb picks up mistakes for you.  at times it makes it better to not have to focus so much on little things.  and i like the way vb is worded more like english.

    on the other hand i have a fondness for the simplistic and direct approach to c#.  it feels less forced in the editor and somewhat cleaner to eliminate excess wording.

    on some days i like one and others i like the other.  depends on my mood.

    i would really like to see a mix of the two languages in one.  i think combining the two would be very interesting.  and possibly the future will be a full integration of the two in some sort of frankenstein masterpiece.  it's alive.  :-)


    FREE
    DEVELOPER TOOLS     CODE     PROJECTS

    DATABASE CODE GENERATOR
    DATABASE / GENERAL  APPLICATION TUTORIAL
    Upload Projects to share or get help on and post the generated links here in the forum
    www.srsoft.us
    Monday, July 19, 2010 2:11 PM
  •  
    "Cor Ligthert" wrote in message news:8a4f7617-f099-4eae-ad16-f18f9b641665...

    (Before you write it, operator overloading makes for me not that different in the languages like you maybe do) For me are the more automatic typing, automatic keywords, solving typos automaticly instead of endless error messages more the differences between C# and VB.

    my response------------------------------------------------------------------------------------

    I guess you have never used a 3rd party add-in tool like Reshaper. And no, you don't get endless error messages in C# when using such a tool.

    As a matter of fact, it was Resharper that stepped-in and actauuly taught me how to  use Lambada expressions in C#, along with the other things it does to improve programmer productivity when using C#. I purshaed Reshaper for my own personal usage.

    http://en.wikipedia.org/wiki/ReSharper

    <copied>

    ReSharper executes solution-wide static code analysis (error detection on-the-fly, without the need to compile), provides additional features for error correction, code completion, navigation, search, syntax highlighting, formatting, code generation and optimization, carries out 40 automated refactorings, and streamlines unit testing using NUnit and MSTest, among other features.

    Monday, July 19, 2010 2:32 PM
  • Yeah Resharper was a huge reason I moved over to C#. What a fandabidosy tool!! The other reason was Rhino.Mocks; used for stubbing/mocking out dependencies in unit testing. Think unit testing itself was a big contributer to the move as well. Unit tests, depending on how you write them, are easier to read in C#. Ahhh but the key point of that statement is 'depending on how you write them'. You want unit tests to be consice, straight to the point.... sharp ... and lambda statements and short anoymous delegates are key! Most of the testing tools use the lambda syntax exclusively, the VB equivalent doesn't look as natural and gets in the way a little bit.

    Monday, July 19, 2010 2:52 PM
  •  
    "Derek Smyth" wrote in message news:6c4ba14f-7bd8-4196-9547-9e4c206c0f02...

    Yeah Resharper was a huge reason I moved over to C#. What a fandabidosy tool!! The other reason was Rhino.Mocks; used for stubbing/mocking out dependencies in unit testing. Think unit testing itself was a big contributer to the move as well. Unit tests, depending on how you write them, are easier to read in C#. Ahhh but the key point of that statement is 'depending on how you write them'. You want unit tests to be consice, straight to the point.... sharp ... and lambda statements and short anoymous delegates are key! Most of the testing tools use the lambda syntax exclusively, the VB equivalent doesn't look as natural and gets in the way a little bit.

    my response ------------------------------------------------------------------------

    Yeah, I have used Reshaper, Rhino.Mocks too and MBUnit to unit test and mock out interfaces when using Model View Presenter, Business Logic Layer and Data Access Layer. I have not used it in unit testing 4.0 ADO.Net Entity Framework as of yet. I have even mocked out Web services with the tools.

    They key to quality code no matter if it's VB or C# is do you understand OOP, DDD and TDD, using TDD to do code coverage unit testing before one does functional testing. A whole lot of things are brought to light when the unit test fails. :)

    I hate to say it, but this is where VB developers are lacking when it comes to designing solutions. I have nothing against VB, and I have used it exclusively in the past prior to .NET.  I do see where in some contract positions I have coming in lately, they are now seeking such expertise on the VB.NET side with n-tier and SOA. But it's going to take someone from the C# side that has used the technology and knows VB to get things implemented, if a company is going with VB.NET.

     

    Monday, July 19, 2010 3:36 PM
  • i have mixed feelings about c#.

    on one hand i like how vb picks up mistakes for you.  at times it makes it better to not have to focus so much on little things.  and i like the way vb is worded more like english.

    on the other hand i have a fondness for the simplistic and direct approach to c#.  it feels less forced in the editor and somewhat cleaner to eliminate excess wording.

    on some days i like one and others i like the other.  depends on my mood.

    i would really like to see a mix of the two languages in one.  i think combining the two would be very interesting.  and possibly the future will be a full integration of the two in some sort of frankenstein masterpiece.  it's alive.  :-)


    FREE
    DEVELOPER TOOLS     CODE     PROJECTS

    DATABASE CODE GENERATOR
    DATABASE / GENERAL  APPLICATION TUTORIAL
    Upload Projects to share or get help on and post the generated links here in the forum
    www.srsoft.us

    Hi Frank,

    What a great idea for a project that would be!!

    What would you call it? CVB ? As in C-flavoured_Visual_Basic? or VBC as in VISUAL_BASIC_in_C_syntax

     

     Dim myPath As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\SomeFile.txt"
    
      'So instead of.>>
      Dim sb As New System.IO.StreamReader(myPath)
      'or.>>
      Dim sb As System.IO.StreamReader = New System.IO.StreamReader(myPath)
    
      'C# ?? >>
      'System.IO.StreamReader sb = New System.IO.StreamReader(myPath);
    
      'What would you suggest?
    

     

    Some people hate the semi-colons too.

     


    Regards, John
    Monday, July 19, 2010 3:37 PM
  • Jeff,

    C# has already so much from VB while VB Net has currently very much from C languages (and Java).

    The C# IDE is in fact more like the  VB6 IDE than the less easy to handle MFC IDE. While when we declare for instance currently in VB a fixed collection or use a property inititializer use curly bracelets.

    The Net parts with the dots is something they share together from Java, there is not used the  C++ -> anymore.

    You can discuss if you like more

    Private x as new List(of String) from {"1","2","3"}
    or in C# the equivalent
    private List<string> x = new List<string> {"1","2","3"};

    I like the first one, it is shorter and tells for me better what it means, but that is probably personal preference.

     

     


    Success
    Cor
    Monday, July 19, 2010 4:01 PM
  • yeah, i would like to be able to drop some of the excess keywords

    maybe like this

    sb New IO.StreamReader(myPath)

    or

    sb = New IO.StreamReader(myPath)

    and

    x new list(string)

    or

    x = new list(string)

    the of keyword throws me off when typing and i would like to not see it anymore.

     

    originally i was thinking more along the lines of being able to write both vb and c# code in the same files, maybe seperated by blocks.

    something like this:

    code region c#

    c code here

    end c#

    code region vb

    vb code here

    end vb

     

    being able to use multiple libraries in a single project is nice but it would be nicer i think to be able to work inside the same project at least.  maybe even as a start, be able to have seperate files for each language type in the same project, besides libraries.

    not really sure overall about it, but i would like to have it more integrated.  it would help me learn the languages better as well.  i could write the code in both language side by side in the same project without having to compile and then add one file to another project.


    FREE
    DEVELOPER TOOLS     CODE     PROJECTS

    DATABASE CODE GENERATOR
    DATABASE / GENERAL  APPLICATION TUTORIAL
    Upload Projects to share or get help on and post the generated links here in the forum
    www.srsoft.us
    Monday, July 19, 2010 4:38 PM
  • Hey Jeff,

    Wouldn't it be nice to do this...

    x = File.Open("")

    and x becomes a StreamReader.

    or x = [0,1,2]

    and x is an array....

    or x = {0,1,2}

    and x is a list

    .... dynamic languages mate, dynamic languages..... no need to declare anything or it's type. It's all inferred.

    F#, Boo, Python, Ruby and the rest....

     

    Monday, July 19, 2010 5:08 PM
  • hey Derek,

    yeah, i hear ya.  at some point i imagine i will be headed that way.

    the other thing i was thinking, now that i think about it,  :-)   is focusing more on some custom classes that will eliminate the need for writing things out so much.  i do this a little bit now but never really put much thought into going too far with it.  may have to sit down one day and put some thunking into it.  yes, thunking.


    FREE
    DEVELOPER TOOLS     CODE     PROJECTS

    DATABASE CODE GENERATOR
    DATABASE / GENERAL  APPLICATION TUTORIAL
    Upload Projects to share or get help on and post the generated links here in the forum
    www.srsoft.us
    Monday, July 19, 2010 5:33 PM
  • Jeff - actually, multi-language assemblies are supported in .net.  Just not by VS :)  Look up netmodules.

    Tom Shelton
    Monday, July 19, 2010 5:47 PM
  •  
    "Cor Ligthert" wrote in message news:f4585dbe-4c83-44f8-a402-d48b7fa49e6b...

    Jeff,

    C# has already so much from VB while VB Net has currently very much from C languages (and Java).

    The C# IDE is in fact more like the  VB6 IDE than the less easy to handle MFC IDE. While when we declare for instance currently in VB a fixed collection or use a property inititializer use curly bracelets.

    The Net parts with the dots is something they share together from Java, there is not used the  C++ -> anymore.

    You can discuss if you like more

    Private x as new List(of String) from {"1","2","3"}
    or in C# the equivalent
    private List<string> x = new List<string> {"1","2","3"};

    I like the first one, it is shorter and tells for me better what it means, but that is probably personal preference.

    my response-------------------------------------------------------------------------------------------------------

    Most C# developers are going to do this.

    var x = new List<string> {"1",  "2", "3"};

    The only time one is going to do what you're talking about is when the declaration is out side the scope of a method.

     

     

    Monday, July 19, 2010 5:54 PM
  • FireAnt.IO is my own code.  If you download the complete project, you'll see it.  It's the namespace of the extension methods...

    Tom Shelton
    Monday, July 19, 2010 5:54 PM
  • C# already does type inference....

     

    var x = File.OpenText(path);
    
    x is a StreamReader.  It is statically typed, you can't suddenly assign a string to x...


    Tom Shelton
    Monday, July 19, 2010 5:58 PM
  • First off John, I doubt anyone would write fully qualified names  on their classes :)  The C# declaration (c# is case sensitive) would usually be used like this:

    using (StreamReader sr = new StreamReader(myPath))
    {
        string line;
        while ((line = sr.ReadLine()) != null)
        {
            // process line
        }
    }
    

     


    Tom Shelton
    Monday, July 19, 2010 6:04 PM
  • Declarations aside - IMHO, the C# IDE has out classed the VB IDE since VS2005.  VS2008 sp1 even added background compile, so the little squiggles appear when you forget a semi-colon, etc.   And it will suggest imports etc as you type, rather then after you hit enter so you don't have to arrow back up to fix the issues.  C#'s IDE is much smoother then VB's. 

    Tom Shelton
    Monday, July 19, 2010 6:10 PM
  •  
    "Cor Ligthert" wrote in message news:f4585dbe-4c83-44f8-a402-d48b7fa49e6b...

    Jeff,

    C# has already so much from VB while VB Net has currently very much from C languages (and Java).

    The C# IDE is in fact more like the  VB6 IDE than the less easy to handle MFC IDE. While when we declare for instance currently in VB a fixed collection or use a property inititializer use curly bracelets.

    The Net parts with the dots is something they share together from Java, there is not used the  C++ -> anymore.

    You can discuss if you like more

    Private x as new List(of String) from {"1","2","3"}
    or in C# the equivalent
    private List<string> x = new List<string> {"1","2","3"};

    I like the first one, it is shorter and tells for me better what it means, but that is probably personal preference.

    my response-------------------------------------------------------------------------------------------------------

    Most C# developers are going to do this.

    var x = new List<string> {"1",  "2", "3"};

    The only time one is going to do what you're talking about is when the declaration is out side the scope of a method.

     

     


    Yes in VB too.

    The one you show is in VB is
    Dim x = new List(of String) from {"1","2","3"}

    However, I know what Tom thinks about this kind of declarations, so I made a full declaration to avoid a discussion about it.
    Tom and I don't agree this since almost 7 years. I've always written that auto inferring should be done in a program language like spellchecking in Word. Tom never agreed  that with me.

     

     

     


    Success
    Cor
    Monday, July 19, 2010 6:41 PM
  • I think you misunderstand my position on auto-inference :)  I don't have a problem when it is used appropriately.  My problem is over use.  And to be honest, I see it more of a problem in C# then VB...

    For instance why do this:

    var i = 1;
    

    instead of this:

    int i = 1;
    

    I know developers who do that, and it drives me crazy.  In the case of generics, fine - you are actually saving your self something.  In the case of linq, well it's sometimes a requirement...  

     

    In C#, I would write the above if it were a local declaration like:

    var x = new List<string>(){"1", "2", "3"};
    
    and have no problem with it :)


    Tom Shelton
    Monday, July 19, 2010 6:59 PM
  • I hate c# only because of it's syntax. When I'm programming, I want to focus on the program itself and not on the issue, where I have forgotten to put a semicolon, or a '{'. The syntax of C# is to me like the chinese language.
    Monday, July 19, 2010 7:13 PM
  •  
    "DerStauner" wrote in message news:63ef709c-171b-48f4-aee2-305e2df6a916...
    I hate c# only because of it's syntax. When I'm programming, I want to focus on the program itself and not on the issue, where I have forgotten to put a semicolon, or a '{'. The syntax of C# is to me like the chinese language.
    my response -----------------------------------------------------------------------------------------------------------------------------------
     
    All this about syntax is much ado about nothing. If one uses any language for any length of time, then one is going to get use to the syntax, which becomes second nature.
     
    When I first took the company paid training for .NET for 8 hours a day for four weeks straight based on C# after working with VB for a number of years, those {} gave me a lot of trouble. Now nine years later, the {} are just part of the flow in writing C# code. And with a tool like Resharper that will complete the statement, sometime you don't want it to, it will put the {} there automatically. 
    Monday, July 19, 2010 8:38 PM
  • I know developers who do that, and it drives me crazy. In the case of generics, fine - you are actually saving your self something.  In the case of linq, well it's sometimes a requirement...  

     


    Hi Tom Shelton,

    If you are referring to a variable being inferred in LINQ then when is it a requirement?

    Would you care to give a Vb.Net example or are you referring to a requirement only in Visual C# ?


    Regards, John
    Monday, July 19, 2010 11:06 PM
  • Sure John..   When ever you work with anonymous types, inference is a requirement.  For instance, if you took my example of using DirectoryInfo.EnumeratFiles and altered the example program like so:

     

    C#:

    using System;
    using System.IO;
    using System.Linq;
    using FireAnt.IO;
    
    namespace FileSystemEnumeratorDemo
    {
      class Program
      {
        static void Main ( string[] args )
        {
          string path = Environment.GetFolderPath ( Environment.SpecialFolder.MyDocuments );
          DirectoryInfo root = new DirectoryInfo ( path );
    
          // get all doc files created before Nov. 1st 2009
          var fileQuery = from fileInfo in root.EnumerateFiles ( "*.doc" )
                  where fileInfo.CreationTime.Date.CompareTo ( new DateTime ( 2009, 11, 1 ) ) == -1
                  select new { Name = fileInfo.Name, CreationTime = fileInfo.CreationTime };
    
          foreach ( var fileInfo in fileQuery )
            Console.WriteLine ( fileInfo.Name );
        }
      }
    }
    
    

    VB.NET:

    Option Strict On
    Option Explicit On
    Option Infer On
    
    Imports System
    Imports System.IO
    Imports System.Linq
    Imports FireAnt.IO
    
    Module Module1
    
      Sub Main()
        Dim myPath As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
        Dim root As DirectoryInfo = New DirectoryInfo(myPath)
    
        ' get all doc files created before Nov. 1st 2009
        Dim fileQuery = From fileInfo In root.EnumerateFiles("*.doc") _
                  Where fileInfo.CreationTime.Date.CompareTo(New DateTime(2009, 11, 1)) = -1 _
                  Select New With {.Name = fileInfo.Name, .CreationTime = fileInfo.CreationTime}
    
        For Each fileInfo In fileQuery
          Console.WriteLine(fileInfo.Name)
        Next
      End Sub
    
    End Module
    
    

    As you can see in those examples, I'm returning an anonymous type - a new object whose type is not known until compile time, so inference is a requirement in this case....

     

    HTH


    Tom Shelton
    Tuesday, July 20, 2010 2:46 AM

  • @Tom continuation characters are less needed in VB2010, however for sure not in Linq
    Cor
    Tuesday, July 20, 2010 7:20 AM
  • VB.NET:

     

    Option Strict On
    Option Explicit On
    Option Infer On
    
    Imports System
    Imports System.IO
    Imports System.Linq
    Imports FireAnt.IO
    
    Module Module1
    
     Sub Main()
     Dim myPath As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
     Dim root As DirectoryInfo = New DirectoryInfo(myPath)
    
     ' get all doc files created before Nov. 1st 2009
     Dim fileQuery = From fileInfo In root.EnumerateFiles("*.doc") _
        Where fileInfo.CreationTime.Date.CompareTo(New DateTime(2009, 11, 1)) = -1 _
        Select New With {.Name = fileInfo.Name, .CreationTime = fileInfo.CreationTime}
    
     For Each fileInfo In fileQuery
      Console.WriteLine(fileInfo.Name)
     Next
     End Sub
    
    End Module
    
    

     

    As you can see in those examples, I'm returning an anonymous type - a new object whose type is not known until compile time, so inference is a requirement in this case....

     

    HTH


    Tom Shelton

    Hi Tom Shelton,

    So what about this then ( OPTION INFER OFF ) ?  :-)    ;-)

     

     

    Option Strict On
    Option Explicit On
    Option Infer Off
    
    Imports System.IO
    
    Public Class Form1
    
     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      Dim myPath As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
      Dim root As DirectoryInfo = New DirectoryInfo(myPath)
    
      ' get all doc files created before Nov. 1st 2009
      Dim fileQuery As IEnumerable(Of FileInfo) = From fileInfo In root.EnumerateFiles("*.doc") _
         Where fileInfo.CreationTime.Date.CompareTo(New DateTime(2009, 11, 1)) = -1 _
         Select New With {.Name = fileInfo.Name, .CreationTime = fileInfo.CreationTime}
    
      For Each fInfo As FileInfo In fileQuery
       Console.WriteLine(fInfo.Name)
      Next
    
     End Sub
    End Class
    

     


    Regards, John
    Tuesday, July 20, 2010 11:32 AM
  • It's like the GM verses Ford debate, and then everyone starts aguing about the best color.

    Bottom line is that as someone who is buying a service, it doesn't matter which they program in.


    Stephen J Whiteley
    Tuesday, July 20, 2010 11:35 AM
    Moderator
  • John....

    I don't think the above will compile with Option Infer Off.  The value returned from that linq query is not IEnumerable(Of FileInfo) - but IEnumerable(Of <anonymous type>).   Because of the Select New With {....} - the type of the return value isn't known until compile time.

    I personally usually have Option Infer Off by default, and only turn it on as needed - much like Option Strict.  I personally feel that it is lazy to leave off the types in most cases.


    Tom Shelton
    Tuesday, July 20, 2010 12:00 PM
  • Cor - ACK.  But, I do not have VS2010 on this particular machine ATM.  So, my example was done in 2008 - and line continuations are very much needed there.
    Tom Shelton
    Tuesday, July 20, 2010 12:02 PM
  • Which language, VB.Net or C# is the best language to choose for development right now?

    The key issue really is who will be supporting this project after the contractor has completed it and what is their preference and level of familiarity with each language. Neither one has a significant advantage over the other. It's like saying which language is better? English or Spanish? Well it all depends upon who you are talking to.

    Paul ~~~~ Microsoft MVP (Visual Basic)
    Tuesday, July 20, 2010 12:41 PM
  • Which language, VB.Net or C# is the best language to choose for development right now?

    The key issue really is who will be supporting this project after the contractor has completed it and what is their preference and level of familiarity with each language. Neither one has a significant advantage over the other. It's like saying which language is better? English or Spanish? Well it all depends upon who you are talking to.

    Paul ~~~~ Microsoft MVP (Visual Basic)

    The problem with you analogy is that it takes a very long time to learn another spoken language, whereas if you know C# or VB.net it shouldn't take you more than a few days to be at least reasonably fluent in the other (if you're a semi decent programmer), and a few days more to be just as good as you were with the language you learned earlier.  I say this from personal experience after having to work in vb.net not long ago for the first time and having some experience working with C#.
    Tuesday, July 20, 2010 1:28 PM
  • The key issue really is who will be supporting this project after the contractor has completed it and what is their preference and level of familiarity with each language. Neither one has a significant advantage over the other. It's like saying which language is better? English or Spanish? Well it all depends upon who you are talking to.

    Paul ~~~~ Microsoft MVP (Visual Basic)

    The problem with you analogy is that it takes a very long time to learn another spoken language, whereas if you know C# or VB.net it shouldn't take you more than a few days to be at least reasonably fluent in the other (if you're a semi decent programmer), and a few days more to be just as good as you were with the language you learned earlier.  I say this from personal experience after having to work in vb.net not long ago for the first time and having some experience working with C#.

    But that's not the point really. We chose Visual Basic .NET because our staff had familiarity with Visual Basic and were comfortable with it. There was really no reason to switch to C# because it didn't offer us any advantages. There were enough obstacles learning a new environment that learning a different language as well wasn't really a consideration.

    I'm familiar with both languages, but I don't like the C# syntax. That's simply my opinion and my preference.


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Tuesday, July 20, 2010 2:31 PM
  • Yeah you cannot really blame? no that's too harsh, disagree with anyone choosing one language over the other. I code C# because for me, for me that is (well actually my team), it has advantages over VB that perhaps you don't need in your development process. There needs to be choice and although one choice to some is better than the other choice you don't really have a right to tell anyone who prefers the other choice that they are wrong. It's the same with everything; it's individuality, it's a decision based on other factors. VB and C# because they are built on the BLR are really almost just about the same, they are just as powerful as each other. Happy coding whatever your language.

    What's better Subversion or Git?  What's better brown bread or white? What's better salt n vinegar or cheese and onion?
    Tuesday, July 20, 2010 4:23 PM
  • What's better salt n vinegar or cheese and onion?
    Whichever flavor the people around you are less likely to ask for some of.

    It never hurts to try. In a worst case scenario, you'll learn from it.
    Tuesday, July 20, 2010 4:30 PM
  • What's better salt n vinegar or cheese and onion?
    Whichever flavor the people around you are less likely to ask for some of.

    It never hurts to try. In a worst case scenario, you'll learn from it.

    That will be boggy cheese and onion then. 
    Tuesday, July 20, 2010 4:31 PM
  • John....

    I don't think the above will compile with Option Infer Off.  The value returned from that linq query is not IEnumerable(Of FileInfo) - but IEnumerable(Of <anonymous type>).   Because of the Select New With {....} - the type of the return value isn't known until compile time.

    I personally usually have Option Infer Off by default, and only turn it on as needed - much like Option Strict.  I personally feel that it is lazy to leave off the types in most cases.


    Tom Shelton

    Hi Tom Shelton,

    It may compile but will it run without errors? Have you tried it?

    I ask as I have not got Visual Studio or Visual C# on this computer.

    Additionally I am not very familiar with the Visual C# I.D.E. as I am with the Vb.Net side of things.


    Regards, John
    Wednesday, July 21, 2010 1:25 AM
  • John...

    In VB.NET - the code I posted will not compile with Option Infer Off - therefore, it can not run.  With Option Infer On it will compile, and run just fine.  I posted those examples right out of VS2008.



    Tom Shelton
    Wednesday, July 21, 2010 2:35 AM
  • John...

    In VB.NET - the code I posted will not compile with Option Infer Off - therefore, it can not run.  With Option Infer On it will compile, and run just fine.  I posted those examples right out of VS2008.



    Tom Shelton

     

    Hi Tom,

    I have just got your code to run with Option Infer Off in Vb.Net with some slight code alterations after I read up on what the

    C# yield statement does. If you would like to see the files I can email them to you or post them in a new thread if you wish?

     

    Though of course I had to put.>>

     

     'Get all doc files created this year.>>
     Dim fileQuery As IEnumerable(Of FileInfo) = From myfileInfo In root.EnumerateFiles("*.doc") Select myfileInfo Where myfileInfo.CreationTime.Date.Year = 2010
    
    

     

    means required inference is no longer required here.

     

    If you would like to see the files I have converted via this tool.>>

    http://www.developerfusion.com/tools/convert/csharp-to-vb/

    with a few tweaks for Vb.Net 2008, then I can email or post them in this forum as mentioned.

     

    By the way, I simply wanted to see if I could get your code to work when converted to VB.Net.    :-)    ;-)

     

     I hope I can do the same with other Visual C# projects. However, I think I will have to learn and practice

    Visual C# more and see if I can do the reverse for VB.Net projects.    :-D

     


    Regards, John
    Wednesday, July 21, 2010 4:07 AM
  • Though of course I had to put.>>

     

    'Get all doc files created this year.>> 
    Dim fileQuery As IEnumerable(Of FileInfo) = From myfileInfo In root.EnumerateFiles("*.doc") Select myfileInfo Where myfileInfo.CreationTime.Date.Year = 2010
    

    That change will make it compile with option infer off - because you are  removing the anonymous type :)   Like I said, sometimes it's required to have option infer off - and one of those places is if you intend to use anonymous types....

    As for getting my code to run in VB.NET - sure it can be made in VB.NET.   The only thing I was saying was that in this particular case, it's easier to accomplish in C#, because of yield return.   Basically, I avoid enumerating the whole directory structure before returning the files - each is returned and processed immediately, giving more of a streaming approach.

    I would mind seeing your code though.


    Tom Shelton
    Wednesday, July 21, 2010 4:37 AM
  • John...

    A custom iterator is implemented in C# using the yield return statement.   It basically causes the compiler to generate and IEnumerable class that maintains state for you.  VB has nothing like this - so it is more work to implement.

    This is normally achieved with two classes - an outer class that Implements IEnumerable(Of T) and a private nested class that implements IEnumerator.

     


    Tom Shelton

    Hi again Tom,

    I did not have to go to that much trouble.

    Creating two classes and Implementing IEnumerable(Of T) or Implement an IEnumerator I mean.

     

     

    I would mind seeing your code though.


    Tom Shelton

    Hi Tom,

    So does that mean you want to see my code then? To me that means, you do not want to see it.

    To me the return TYPE of a Linq query is not anonymous in Vb.Net as hovering your mouse

    over a variable name will tell you what it is. ;-)

     


    Regards, John
    Wednesday, July 21, 2010 4:39 AM