Peter's Gekko

Sponsors

The Lounge

Wicked Cool Jobs

News

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
VB (.NET) or C# ? No need to choose

Dan Appleman has published a very neat article on VB.NET and C#. It's not about which one is a better language, which is a non-issue, but does show how to mix the best of both. Using the visual basic namespace in a piece of C# you can use the VB financial functions in your C# code.

<quote>

using Microsoft.VisualBasic;
........
Console.Write("Your payment is: ");
Console.WriteLine(Financial.Pmt(.05/12,    30*12,100000,0,  DueDate.BegOfPeriod).ToString("$0.00")) ;
</quote>

That's what .net is about.

Peter


Posted Fri, Jun 11 2004 7:24 AM by pvanooijen

[Advertisement]

Comments

C# wrote re: VB (.NET) or C# ? No need to choose
on Mon, Dec 13 2004 8:23 PM
I hear ya when someone besides MSFT writes a component and you reference the component... that is what a component language is about. But I don't feel .net should go down the path of referencing another language runtime for every class that has common business functions that any language should have innately available. Put those common helper classes and enums into the system namespace exactly where the Math class is! (all .net languages should have them available in the system namespace - shouldn't have to reference another language). Think how pissed VB coders would be if MSFT removed the DateAndTime class from the vb.net runtime, but put it into the C# language only. Then every VB.NET program would have to reference the C# runtime and namespace in order to use it. Microsoft needs to create new FCL Financial and DateAndTime classes (using decimal instead of double where when dealing with currency) that are part of the core of the .net framework. No one wants to write all that crap over and over again. Sucks that I got to convert everything from decimal to double then back to decimal. Would love to get rid of all my VB wrapper methods!



Peter van Ooijen wrote re: VB (.NET) or C# ? No need to choose
on Tue, Dec 14 2004 4:04 AM
Agree but there is no such thing as the C# versus the VB.NET runtime. There is only a Common Language Runtime. In which you can load assemblies with funny names as "Microsoft.VisualBasic". Which could be coded in something like cobol.net. Who knows ? Who cares ?
Peter's Gekko wrote Creating a COM server with .NET. C# versus VB.NET and the WithEvents keyword
on Tue, Aug 2 2005 9:15 AM
I am a C# guy. This is a matter of personal preference,&amp;nbsp; I know how to code with VB.NET but just...
Peter's Gekko wrote Creating a COM server with .NET. C# versus VB.NET and the WithEvents keyword
on Fri, Sep 23 2005 10:24 AM
I am a C# guy. This is a matter of personal preference,&amp;nbsp; I know how to code with VB.NET but just...

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Devlicio.us