Hi,
Some bits snipped for clarity and focus.
Before I say anything further I will admit now to the whole
group that I had not fully investigated all of what I had said
certainly the byte[] example.
Now to continue...
Because useless overhead of a string concatenation is introduced and the
code is harder to understand. The solution you posted is a "workaround".
I wouldn't consider that "best-practice".
Wrong. The implementation of VB.NET's 'Len' function looks like this:
\\\
Public Shared Function Len(ByVal Expression As String) As Integer
If Expression Is Nothing Then
Return 0
End If
Return Expression.Length
End Function
///
If that implementation of Len() is correct then why in your original example
code did you write MsgBox(CStr(Len(s)) when the CStr() according to
your implementation of Len is not needed.
I suggest to take a closer look at 'Microsoft.VisualBasic'. As I have
already said, 'Microsoft.VisualBasic' often extends existing framework
functionality and makes it ready for direct use within the code.
No - I suggest you stop trying to be all high and mighty and read
correctly what I have said. My original post and aim was to remove
functions and constants which are replicated in the framework, i.e.
Left(). You are quick to slap me down when I have made a mistake
and I admited at the start of this message that I had. However when
I make a valid point or slap you down your response is to go off on
a completely different tangent. Example: My response regarding use
of Select...Case...
Well, does '+' not tell you that it works on numbers?! Everybody who
/learns/ VB.NET will learn what 'Left' does as it's part of Visual Basic
.NET.
+ could work on number but it could just as well work on strings.
Your argument seems to say "read the function called, ignore all the
parameters involved and you should be able to say exactly what is
happening".
Left(myVariable, 5) does not necessarily tell you that it is working with
strings. And you have fallen foul of your own argument. You say, and I
quote "Everybody who /learns/ VB.NET will learn what 'Left' does",
so therefore why is it so bad to /learn/ what Substring() does and use
that instead of Left(). And don't say "because it's easier to read" because
it is not. You either know what a function is for or you don't and when
reading code to find out what it's doing you read it and take into account
the parameters passed not just the name of the function.
Bad example I was wrong. In C# this would cause a runtime error because
X is a long.
Wrong. '+=' is the equivalent to 'AddHandler'. C# doesn't provide
support for declarative event handling.
Wrong again. Even if a variable is not declared 'WithEvents', handlers
can be added using 'AddHandler'. 'WithEvents' enables declarative event
handling ('Handles').
I am shocked that people are basing their decisions on such a lack of
knowledge...
I have not checked if what you have said about WithEvents is correct but
it sounds like you are. I apologise for not checking myself first.
However again you have sidestepped all the other things I pointed out
to pick on a single thing. You have not said anything in return to:
- VB has no operator overloading, C# does.
- VB requires use of function calls when adding event handlers
programmatically
C# does not.
- VB requires a function call to convert the simplest of types C# does not,
i.e.:
CStr(myNumber) as opposed to - (string)myNumber
Regards,
Peter