Requesting advice on methods to use

Y

yashgt

Hi,
I am writing an application in VB .NET 2005. Is it a good idea to use
VB 6-like functions such as Trim, MsgBox, Val, etc. or should I think
of using members of the System.String class, MessageBox class, etc.?
What are the pros and cons?

Thanks
 
J

Jon Skeet [C# MVP]

I am writing an application in VB .NET 2005. Is it a good idea to use
VB 6-like functions such as Trim, MsgBox, Val, etc. or should I think
of using members of the System.String class, MessageBox class, etc.?
What are the pros and cons?

I'd use the non-Microsoft.VisualBasic methods unless there's something
you want which isn't easily provided by the "normal" framework. That
way it's easier for other .NET developers who may not know VB6 to
understand your code, and it'll probably be more object-oriented too.
 
D

dgk

Hi,
I am writing an application in VB .NET 2005. Is it a good idea to use
VB 6-like functions such as Trim, MsgBox, Val, etc. or should I think
of using members of the System.String class, MessageBox class, etc.?
What are the pros and cons?

Thanks

I like using the Net versions because it makes my skills more
transportable if I get a job in another language, which won't ever
happen because I'm a VB kind of guy.

But, when .Net first came out, I examined the IL produced by a VB
function (maybe Left?) compared to the IL produced by the equivalent
..Net method and the code was not the same. Now, perhaps JIT compiles
the IL into the same runtime code, but I don't know.
 
N

Nick Malik [Microsoft]

Hi,
I am writing an application in VB .NET 2005. Is it a good idea to use
VB 6-like functions such as Trim, MsgBox, Val, etc. or should I think
of using members of the System.String class, MessageBox class, etc.?
What are the pros and cons?

Thanks

Personal preference in most cases. I usually use the .Net ones for two
reasons:
1) when I see an example or snippet I want to use, it nearly always uses
..Net calls.
2) if I want to convert a module to C#, it is far easier if it is written
using .Net calls.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top