F
Fabio
I am wondering where you got the perception that 'Mid' should not be used!
Oh, you can also use all the windows sdk programming via API, but this isn't
the best way to work with .net
I am wondering where you got the perception that 'Mid' should not be used!
I think that most VB6 programmers know that it VB6 uses COM (ActiveX), but
I always get stunned when some VB6 developer asks me what regsvr32.exe
is... ;-)
Fabio said:Oh, you can also use all the windows sdk programming via API, but this
isn't the best way to work with .net
Herfried K. Wagner said:'Mid' is actually .NET .
Fabio said:also
obj = Activator.CreateInstance(Type.GetTypeFromProgID(myComId, true))
...
Marshal.ReleaseComObject(obj)
is .NET... but we cannot lament about vb.net performances if we use old
vb6 code (that produces trash IL).
Could you give some samples where using 'Mid', 'Right', and 'Left' would
produce "trash IL"? It's even possible to write semantically incorrect
code using the low-level 'String.Substring' method.
Other than one line of code, the IL is identical.
Fabio said:Is not identical the IL to be executed since with vb.net the CLR has to
run lot of useless IL code to get the same result. Stop.
And don't talk about the difficulty of VBers in understanding c# code and
vice-versa just because VB people don't know how to write .Net app.
Fabio said:Is not identical the IL to be executed since with vb.net the CLR has to run
lot of useless IL code to get the same result. Stop.
And don't talk about the difficulty of VBers in understanding c# code and
vice-versa just because VB people don't know how to write .Net app.
I am an estimator of VB6, but I begin to think that the folks that say "vb
programmers are lamers" was right.
Herfried K. Wagner said:Well, it's actually more often C# programmers not understanding VB's
function/class library than VBers not understanding the classes of the .NET
Framework.
And don't talk about the difficulty of VBers in understanding c# code and
vice-versa just because VB people don't know how to write .Net app.
I am an estimator of VB6, but I begin to think that the folks that say "vb
programmers are lamers" was right.
Jon Skeet said:Earlier you wrote:
<quote>
I am wondering where you got the perception that 'Mid' should not be
used!
</quote>
Isn't what you wrote above a good enough reason?
Yes, Mid is in .NET. It's in an assembly specifically created for VB
support, however - hence its name. For the maximum readability for all
.NET programmers, I'd suggest using the more commonly known string
manipulation libraries (ie System.String and the System.Text and
System.Text.RegularExpressions namespaces).
Put it this way - it's entirely possible to use the Java-support
redistributable and start using the Java API to manipulate strings too
- but I wouldn't recommend that, either.
Herfried K. Wagner said:Note that I don't recommend to blindly use VB's string manipuliation
functions instead of those in the .NET Framework's class library. I simply
recommend to use them when using them makes sense (features missing in the
.NET Framework's class library) or if I consider them more high-level than
the equivalent methods in the .NET Framework.
I would not recommend it either, but what if one of the methods provided
there is missing in the .NET Framework? In a J# application it would IMO be
the natural choice to use the Java API method. I am not sure where you
would draw the line between using language-specific features versus using
.NET Framework features.
Would you recommend to use '+' for string concatenation in VB.NET instead of
'&' only for the reason other programming languages use '+' too? Did you
refuse to use 'using' blocks in C# 1.* only because VB.NET didn't have an
equivalent syntactic construct? Personally I don't think it makes much
sense to refuse using constructs, be it syntactic constructs or library
features, only for the reason of not having an equivalent in another
programming language.
There is no programming language which can claim to be "the only programming
languge designed for the .NET Framework" except maybe ILASM. Different
programming languages have different historical backgrounds and cultures,
and serve different purposes, which means that they are optimized for
certain scenarios. Consequently they provide their own extensions to the
.NET Framework which make dealing with these scenarios easier.
Back in the '60s when I started work, we had to write our programs on codingHomer said:C# programmers are pussies. Real programmers write machine code - in ink.
1) It's not as OO as using a method on the String class
2) There's a direct equivalent in String.Substring
3) Users of other languages are more likely to understand Substring
4) The Microsoft.VisualBasic assembly may not be entirely implemented
in other CLR implementations, whereas System.String certainly will
be
5) Due to being less widely used than System.String, it's more likely
to have bugs. This is a general point about the
Microsoft.VisualBasic assembly, which isn't as widely used as the
equivalents in the System.* assemblies. For instance, last time I
looked hard at Asc and Chr (IIRC) there was distinctly odd behaviour
in terms of which character encoding was actually used. (It depended
on the first use within the app, I believe.)
6) It's less efficient as it's performing all the checks that Substring
performs before calling Substring.
Cor Ligthert said:Why this is really an answer Herfried does not deserve
he knows well as probably you do that this is beside the truth a
method has nothing to do with OO.
It is not true because Mid is more efficient.
But even as it was like that: There is a direct equivalent for meat,
which is flesh however it sligly different used.
Why only those who have used one of those that larch bunch of languages who
are derived from C or those who have used languages, where it was
remembering me that start just a kind of added method. It is not in PL
languages, not in Cobol, not in Algol, not in Fortran, not in Macro
Assemblers etc etc.
Than it is not Net.
I know that the Reliant has/had 3 wheels, however it was
only popular in Brittain where it was called a Car, there were it was
slightly used in Holland and Germany it was more a shielded motorbike.
Yes that is mostly as programs have more posibilities, if this is an
argument, than use only some base Intel assembler code. Those don't have
that problem.
That is only important as there is performance need, although 1 as showed
that it takes more are problably gained by the more efficient way as it is.
And here I stop. I never use Mid anymore by the way as I don't use any
String function from the Microsoft Visual Basic. I do have to admit that I
don't know why, however probably mostly because they use the one indexer
instead of the zero indexer, by what I become often confused.
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.