B
Bill McCarthy
The .SubString method of the string
Greg said:I know I can use the Microsoft.VisualBasic.Left function to get the
left portion of a string, but I would prefer to avoid using any
Microsoft.VisualBasic namespace items. What is the equivilant in
VB.Net 2005?
Greg said:I know I can use the Microsoft.VisualBasic.Left function to get the left
portion of a string, but I would prefer to avoid using any
Microsoft.VisualBasic namespace items. What is the equivilant in VB.Net
2005?
Cor Ligthert said:Greg,
Why do you want only to use a part of the Net framework as you can use the
whole framework?
Sounds to me as buying a Mercedes but want to driver it like a bicycle.
Cor
Scott M. said:A great many people feel the same way as the OP, in that they would prefer
not to use language-specific functions to manipulate objects, when the
objects themselves provide the same functionality.
Some dislike using the legacy functions of VB for fear that at some point
in the future MS will deprecate them.
Some dislike using them because they want their code to be more easily
ported to another .NET language in the future.
Some dislike using them because their usage doesn't feel like true OO
syntax (just calling a method without specifying an object or type).
I'm sure you know about these points and that it has been debated over and
over again. But, not wanting to use these legacy VB functions is a
perfectly resonable approach to VB .NET.
Greg said:I know I can use the Microsoft.VisualBasic.Left function to get the
left portion of a string, but I would prefer to avoid using any
Microsoft.VisualBasic namespace items. What is the equivilant in
VB.Net 2005?
However a lot of functions in Visual Basic are very helpfull, and because
they are standard part of the Framework, there is no anyneed to avoid
them. Why would I avoid AdoNet while there now is Linq. That VisualBasic
is in the Microsoft namespace and the rest not, had in my idea only a
political reason when Net started.
That your clients have other thoughts, let them go, but don't forget to
let them pay for that you cannot use very well functions.
Maybe they ask you tomorrow to uce only pencils and no computer anymore.
You never know with this kind of clients.
Cor
should use C#.
The single biggest strengths of Basic over C derived languages are the
case insensitivity and semi-intelligent string handlers.
Mike.
Scott M. said:A great many people feel the same way as the OP, in that they would prefer
not to use language-specific functions to manipulate objects, when the
objects themselves provide the same functionality.
Some dislike using the legacy functions of VB for fear that at some point
in the future MS will deprecate them.
However, there is a good reason to not use the Left and
Right string functions in VB and that is that they are basically useless
in a Windows Forms object as the Form.Left and Form.Right override
them.
Cor Ligthert said:However, the use of First and Zero is in my opinion the largest legancy
their is in computer busines. I avoid using the First as index point as
some Microsoft Visual Basic functions do, just because it is still not
well done in any language.
Trying to make it more clear, that Zero starting point legancy comes
purely from hardware languages and is never changed. while everthings else
has back to normal human use in programming languages. This try with
Visual Basic never succeed.
Herfried K. Wagner said:If one does not use 'Left', why not stop using 'Select Case' too?
Some dislike using the legacy functions of VB for fear that at some point
VB's syntax is mostly legacy syntax, as is C#'s syntax. I don't think it
makes sense to draw a line between language syntax and the VB runtime
library, which has always been tied heavily to the programming language.
Scott M. said:I think you've missed my point Cor. If there are 2 ways to get the same
job done and one is more consistent with the overall framework and doesn't
lead me into a possible dead-end, I'm going to go for that one. A great
many people out there wouldn't be surprised if support for these functions
were to disappear in the futue and then your code would have to be
re-worked, but mine won't.
Herfried K. Wagner said:Just give me one reason why these functions are more likely to
disappear than those in the .NET Framework. Both are well-tested
code, and both are heavily used. Note that they have even survived
the pre-.NET/.NET migration step!