A
Armin Zingler
Chad Z. Hower aka Kudzu said:No problem.
BTW - sorry if sounded forceful in my other replies. No disrespect
intended - Im just a very forceful in debates.
No problem either. Didn't sound forceful to me.
Chad Z. Hower aka Kudzu said:No problem.
BTW - sorry if sounded forceful in my other replies. No disrespect
intended - Im just a very forceful in debates.
Cor said:VB6 programs where never as fast as C++ and that is nowhere written.
The ones who start with a new program should set option Strict On in the
VS.net options, than you have not even to declare it and behaviour is as
you wish.
Cor said:Start a debat that is about VB.net without C# with Armin, than you will see
what is forceful
Cor said:VB has one big benefit it is not a should language, but a could language..
Klaus Löffelmann said:why not writing a wrapper DLL for VB, that wraps around the related
objects. And about the Using- (Imports-) Business. How do you access a
namespace in c# without "Using" it?
* "Klaus Löffelmann said:I wouldn't call VB the king language of anti type safety. At least, not
anymore. And, of course, only if you set
Option Strict True
Stephen Martin said:Operator overloading is something of a mixed blessing at best and
overloading the implicit operator is probably the diciest of all. In
general, using an implicit conversion operator on a custom type is not a
good idea and should be restricted at most to a few specialized value
types. Using an implicit conversion operator between reference types is
almost always a very bad idea since it makes reference types act as
value types without warning (i.e. a reference is no longer copied, a new
object is created) along with several other problems to do with
readability, etc. Implicit casts should really be used only for casting
to a base class. In fact, if faced with a library that used implicit
That having been said, in your scenario a) won't work: DirectCast can
only cast to a type that the object already is, for example upcasting or
casting to an interface that the object implements. CType does other
operator. Choice b) is better it makes clear that you are creating a new
object based on the input object but it is a little non-standard. Choice
c) is, in my opinion, clearly the best. As to the name of the conversion
op_Implicit that can be called from VB but it would be better to
implement functions along the lines of FromXXX and ToXXX when you want
to implement custom conversion routines.
providing conversions......when you do not have access to alter base classes, its very important in
ALL implemented this way internally to .net......a true OOP system cannot function without it. Floats, integers, etc are
reference....They are not limited to value types, and you do not convert the
If you want to convert(morph?) between the interfaces implemented by an...It allows one interface to morph onto another.
Stephen Martin said:method of doing conversions. Explicit conversion operators, conversion
functions and conversion constructors are all superior.
certainly highly debatable. Also, your reference to floats, integers,
etc. is somewhat disingenuous, I was explicitly speaking of custom types
not primitives and I added that there are some instances where an
variable you are actually creating a new object and then assigning its
reference to the variable (unless of course your conversion operator
returned a this reference but that would be rather unusual). This then
makes your reference types act like value types (copy on assignment), at
least an explicit conversion operator gives you warning (though a
conversion function or conversion constructor would be better).
Also, again I might be misunderstanding, but your code listing states
that LOutput is of type System.IO.FileStream. In order to pass it to
your method you are casting it to type Borland.Vcl.Classes.TStream. If
this is correct then DirectCast should only work if LOuput is already of
type Borland.Vcl.Classes.TStream, but this isn't the case since it is
It's possible we're not understanding each other, talking past each
other so to speak. To clarify what you are talking about perhaps you
could post the code here for your implicit operator and a link to the
'demo' to which you referred.
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.