On Apr 23, 2:14 pm, cj <c...@nospam.nospamwrote:
I am under the impression they are obsolete methods included for
backward compatibility. For instance is using
filedatetime("c:\myfile.txt") still the accepted way of getting the date
c:\myfile.txt was last modified? I see filedatetime is in the
Microsoft.VisualBasic namespace. Is there some
dim file as new something
dim lastchanged as date = file.datetime
method we are supposed to use now?
If so what would make it better than filedatetime("c:\myfile.txt")???
I try to avoid functions in microsoft.visualbasic because I want to
learn the new way of doing things but frequently I find the new way is
longer and seems more confusing. Like my example filedatetime(). It'll
do what I need now but should I look for something else???
You'll get a lot of different opinions on this issue. Largely, what
you should do depends on what you plan to do in the future.
If you're planning to become a hard-core .NET developer, you should
definitely learn the .NET way of doing things. (This is especially
true if you want to learn other .NET languages.) The
Microsoft.VisualBasic namespace does include a lot of stuff that is
there to ensure that VB6 code is portable to .NET; we are encouraged
to move away from that namespace to the functionality provided by the
core System namespaces.
The real value of that depends on a number of factors. Is the code
going to be ported to other languages? Will it be used by other
systems? Is it a code library? Or is it a self-contained application
that's a one-shot and not likely going to be used anywhere else?
Practicality should always govern what you decide to do. However,
practicality does *not* mean that you should always have blinders on,
or suffer from a very narrow world view.
Plan for the future. My suggestion is that you keep at it, and move
away from the Microsoft.VisualBasic namespaces. The payoff is
worthwhile. The C# samples that are pervasive don't use that
namespace; you'll find that they're much easier to understand and port
to Visual Basic.NET if you know what they're doing. :) Further, the
pain customary to the learning period is short-lived; once you know
it, you *know* it, and you'll have much more value to everyone.
I hope I haven't overwhelmed you. (I tend to do that sometimes.)
Cheers!
Mike Hofer