What can I do with C#, that I can't do with VB.Net ? 
Author Message
 What can I do with C#, that I can't do with VB.Net ?

Any idea ?
I need this to move a VB-programmer to C#.
I haven't found an article on MSDN.

Thanks,
Henryk



Mon, 28 Mar 2005 14:42:25 GMT  
 What can I do with C#, that I can't do with VB.Net ?
Very little. Although you code will have fewer characters :) If he's a VB
programmer, leaver the poor guy alone and let him use VB.NET.

John


Quote:
> Any idea ?
> I need this to move a VB-programmer to C#.
> I haven't found an article on MSDN.

> Thanks,
> Henryk



Mon, 28 Mar 2005 14:55:13 GMT  
 What can I do with C#, that I can't do with VB.Net ?
why would you ever 'need' someone to move from one .net language to another
?  language bigotry is not pretty ;-)

i actually had the recent occasion to have to go the other way around
because of things that VB can do that C# can't - at least not without either
a lot of ugly casting or writing a wrapper class that would then have to be
updated with future releases of a component.
we needed to work with a 3rd party (ibm) com component written with vb in
mind which almost exclusively uses generic objects rather than properly
typed objects - this was a real pita in c# but a no brainer in vb.  ie. most
( but not all ) objects could be declared and instantiated using their
proper types , however any methods / properties that return references to
any of these objects always does so as 'object' rather than the proper type
and there are a number of critical & common objects that could only be
accessed via methods of other objects and for which a cast to the proper
type was illegal according to the c# compiler !!!.
imagine a string class where every method returns another string except that
the returned strings are always objects rather than strings and you get the
idea of how much casting is then inolved.

what should be simple thing :
  xString x = new xString("some text");
  xString y = x.SubStr(1,1).Upper();

ends up more like :
  xString y = ( (xString) ( (xString) x.SubStr(1,1) ).Upper() ) );

because xString::SubStr() & xString::Upper() both return the type object
rather than the documented type xString

if there is a simple solution to this 'object' problem in c# , feel free to
educate me , it would be appreciated.


Quote:
> Any idea ?
> I need this to move a VB-programmer to C#.
> I haven't found an article on MSDN.

> Thanks,
> Henryk



Mon, 28 Mar 2005 20:57:53 GMT  
 What can I do with C#, that I can't do with VB.Net ?

Quote:

> if there is a simple solution to this 'object' problem in c# , feel free to
> educate me , it would be appreciated.

"Get better components" is the one which comes to mind, I'm afraid. If
you use daft libraries which don't tell you what they return properly,
you just *won't* be able to do safe compile-time type checking
(obviously!).

--

http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too



Mon, 28 Mar 2005 21:22:40 GMT  
 What can I do with C#, that I can't do with VB.Net ?


Quote:
> why would you ever 'need' someone to move from one .net language to
another
> ?  language bigotry is not pretty ;-)

It might be that a company has made the decision to standardise on, say, C#
because most of the developers come from a C/C++ background and are more
comfortable with the syntax but the company also has a few VB developers.
Or, it could be the other way round.

However, speaking more generally, I think that .NET developers should be
open to using more than one language since, as you amply demonstrate below,
there are situations where it is convenient to switch to another language
for part of the application (or you may want to use a sample written in
another language). All languages may be equal with respect to accessing the
.NET FCL but they are not all equal in other respects. Most contain at least
a few useful features that others don't, as you describe below.

Quote:

> i actually had the recent occasion to have to go the other way around
> because of things that VB can do that C# can't - at least not without
either
> a lot of ugly casting or writing a wrapper class that would then have to
be
> updated with future releases of a component.
> we needed to work with a 3rd party (ibm) com component written with vb in
> mind which almost exclusively uses generic objects rather than properly
> typed objects - this was a real pita in c# but a no brainer in vb.  ie.
most
> ( but not all ) objects could be declared and instantiated using their
> proper types , however any methods / properties that return references to
> any of these objects always does so as 'object' rather than the proper
type
> and there are a number of critical & common objects that could only be
> accessed via methods of other objects and for which a cast to the proper
> type was illegal according to the c# compiler !!!.
> imagine a string class where every method returns another string except
that
> the returned strings are always objects rather than strings and you get
the
> idea of how much casting is then inolved.

> what should be simple thing :
>   xString x = new xString("some text");
>   xString y = x.SubStr(1,1).Upper();

> ends up more like :
>   xString y = ( (xString) ( (xString) x.SubStr(1,1) ).Upper() ) );

> because xString::SubStr() & xString::Upper() both return the type object
> rather than the documented type xString

> if there is a simple solution to this 'object' problem in c# , feel free
to
> educate me , it would be appreciated.



> > Any idea ?
> > I need this to move a VB-programmer to C#.
> > I haven't found an article on MSDN.

> > Thanks,
> > Henryk



Mon, 28 Mar 2005 21:56:33 GMT  
 What can I do with C#, that I can't do with VB.Net ?


Quote:

> > if there is a simple solution to this 'object' problem in c# , feel free
to
> > educate me , it would be appreciated.

> "Get better components" is the one which comes to mind, I'm afraid. If
> you use daft libraries which don't tell you what they return properly,
> you just *won't* be able to do safe compile-time type checking
> (obviously!).

And that is a daft answer that just evades the issue. What if this component
is the only, or best, one that meets the client's requirements, even though
it's design may be less than perfect? What should the client do? Rewrite it
from scratch? Perhaps they cannot afford to do that. Spend 2 years waiting
for another company to provide a better component? Perhaps they cannot
afford to do that either.


Mon, 28 Mar 2005 22:04:58 GMT  
 What can I do with C#, that I can't do with VB.Net ?

Quote:

> > "Get better components" is the one which comes to mind, I'm afraid. If
> > you use daft libraries which don't tell you what they return properly,
> > you just *won't* be able to do safe compile-time type checking
> > (obviously!).

> And that is a daft answer that just evades the issue. What if this component
> is the only, or best, one that meets the client's requirements, even though
> it's design may be less than perfect? What should the client do? Rewrite it
> from scratch? Perhaps they cannot afford to do that. Spend 2 years waiting
> for another company to provide a better component? Perhaps they cannot
> afford to do that either.

Then you have a problem. You can take one of three unpalatable routes:

o Write C# code which is full of casts
o Rewrite the library
o Use VB against the company policy (or whatever else is saying to use
  C#)

One potential alternative which *might* be more palatable would be to
write some a .NET component which wrapped the library up in a better
API. That may or may not be possible depending on the component.

Seriously though - is "get a better library" always a daft answer? What
about other flaws, such as: "It reboots the machine once a month,
unpredictably"? All of the rest of your criteria might still be met. I
don't think that looking for a better library is a daft answer, to be
honest.

--

http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too



Mon, 28 Mar 2005 22:18:20 GMT  
 What can I do with C#, that I can't do with VB.Net ?
a 'daft' answer , maybe.  naive , definitely.
a very real 'problem' with components in the real world is that you are
often stuck with what you are given.

you hit it right on the head - there is only one component available and we
don't have any choice other than to use it.  re-writing is out of the
question as it is not ours to re-write.  this component has been around for
many years and has been re-released/upgraded a number of times, the most
recent being within the last year , it seems that the vendor ( currently
ibm ) just does not see this as an issue.

one point that is missed here is that this type of design is not necessarily
'daft'.  there are a huge number of components out there that do this very
thing for the simple reason that they were written with VBesque languages in
mind where this situation is not an issue.


Quote:




> > > if there is a simple solution to this 'object' problem in c# , feel
free
> to
> > > educate me , it would be appreciated.

> > "Get better components" is the one which comes to mind, I'm afraid. If
> > you use daft libraries which don't tell you what they return properly,
> > you just *won't* be able to do safe compile-time type checking
> > (obviously!).

> And that is a daft answer that just evades the issue. What if this
component
> is the only, or best, one that meets the client's requirements, even
though
> it's design may be less than perfect? What should the client do? Rewrite
it
> from scratch? Perhaps they cannot afford to do that. Spend 2 years waiting
> for another company to provide a better component? Perhaps they cannot
> afford to do that either.



Mon, 28 Mar 2005 22:21:29 GMT  
 What can I do with C#, that I can't do with VB.Net ?

Quote:

> a 'daft' answer , maybe.  naive , definitely.

Unsurprisingly, I disagree. I fully accept that it won't always be
possible to find a replacement, but it's still worth *trying* - and also
complaining to the vendor that what they're providing just isn't
suitable for anything other than use within VB. Of course, if they're
only claiming to support it on VB, then it's the company's fault for
moving away from VB. It would be like me complaining to Jakarta that
they're not providing a C# interface for Tomcat...

Quote:
> a very real 'problem' with components in the real world is that you are
> often stuck with what you are given.

And if you just accept that with no complains, nothing will change.

Quote:
> you hit it right on the head - there is only one component available and we
> don't have any choice other than to use it.  re-writing is out of the
> question as it is not ours to re-write.  this component has been around for
> many years and has been re-released/upgraded a number of times, the most
> recent being within the last year , it seems that the vendor ( currently
> ibm ) just does not see this as an issue.

I would argue that they will *continue* not to see it as an issue while
people still buy it regardless. Can I ask whether or not you've actually
complained about this yet?

Quote:
> one point that is missed here is that this type of design is not necessarily
> 'daft'.  there are a huge number of components out there that do this very
> thing for the simple reason that they were written with VBesque languages in
> mind where this situation is not an issue.

That explanation just won't wash in the .NET era, where cross-language
support is vital. Component vendors who supply components which will
only work with one language will hopefully be overtaken by those who
design components with cross-language support in mind. It doesn't sound
like it would be terribly difficult for IBM to do, in this case, either
- you just need to make enough of a fuss for them to see that it's an
issue for you.

Depending on the type of component, you might also consider the wrapper
idea I mentioned in another post. I had to write something similar
recently. I was using a library which *should* have worked in both VB
and VC++, but mysteriously failed in VC++. Even the vendor's sample app
failed (which did make me wonder somewhat about their QA department...)
In the end I had to write a small VB COM wrapper where each method just
called the "real" one. I then wrote most of the app in VC++ as normal.
Ugly, but it worked. Whether or not something similar is appropriate
depends very much on the case in point though.

--

http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too



Mon, 28 Mar 2005 22:44:14 GMT  
 What can I do with C#, that I can't do with VB.Net ?


Quote:

> > a 'daft' answer , maybe.  naive , definitely.

> Unsurprisingly, I disagree. I fully accept that it won't always be
> possible to find a replacement, but it's still worth *trying* - and also
> complaining to the vendor that what they're providing just isn't
> suitable for anything other than use within VB. Of course, if they're
> only claiming to support it on VB, then it's the company's fault for
> moving away from VB. It would be like me complaining to Jakarta that
> they're not providing a C# interface for Tomcat...

> > a very real 'problem' with components in the real world is that you are
> > often stuck with what you are given.

> And if you just accept that with no complains, nothing will change.

> > you hit it right on the head - there is only one component available and
we
> > don't have any choice other than to use it.  re-writing is out of the
> > question as it is not ours to re-write.  this component has been around
for
> > many years and has been re-released/upgraded a number of times, the most
> > recent being within the last year , it seems that the vendor ( currently
> > ibm ) just does not see this as an issue.

> I would argue that they will *continue* not to see it as an issue while
> people still buy it regardless. Can I ask whether or not you've actually
> complained about this yet?

> > one point that is missed here is that this type of design is not
necessarily
> > 'daft'.  there are a huge number of components out there that do this
very
> > thing for the simple reason that they were written with VBesque
languages in
> > mind where this situation is not an issue.

> That explanation just won't wash in the .NET era, where cross-language
> support is vital. Component vendors who supply components which will
> only work with one language will hopefully be overtaken by those who
> design components with cross-language support in mind. It doesn't sound
> like it would be terribly difficult for IBM to do, in this case, either
> - you just need to make enough of a fuss for them to see that it's an
> issue for you.

what really won't wash in the .NET era is assuming that there is a .NET era.
it will a very long time before all traces of 'old' technologies disappear.
i agree .NET is great , but it is not everything.  assuming that you will
always be able to operate in 100% complete islolation is naive to an
extreme.

Quote:

> Depending on the type of component, you might also consider the wrapper
> idea I mentioned in another post. I had to write something similar
> recently. I was using a library which *should* have worked in both VB
> and VC++, but mysteriously failed in VC++. Even the vendor's sample app
> failed (which did make me wonder somewhat about their QA department...)
> In the end I had to write a small VB COM wrapper where each method just
> called the "real" one. I then wrote most of the app in VC++ as normal.
> Ugly, but it worked. Whether or not something similar is appropriate
> depends very much on the case in point though.

so in the end my original point was valid and your solution was very naive
as obviously you yourself have run into the same situation and decided to
make do with a 'daft' component by simply switching langauges.

i thought about this wrapper idea but decided that it was way too much
hassle , especially considering that the real differences between c# and
vb.net are so slight.
it was much quicker and infinitely cleaner just to move the whole project
into vb.net.

anyway - enough from me on the subject.

Quote:

> --

> http://www.pobox.com/~skeet/

'preacher' - not surprised by that at all ;-)

- Show quoted text -

Quote:
> If replying to the group, please do not mail me too



Mon, 28 Mar 2005 23:10:18 GMT  
 What can I do with C#, that I can't do with VB.Net ?

Quote:

> > That explanation just won't wash in the .NET era, where cross-language
> > support is vital. Component vendors who supply components which will
> > only work with one language will hopefully be overtaken by those who
> > design components with cross-language support in mind. It doesn't sound
> > like it would be terribly difficult for IBM to do, in this case, either
> > - you just need to make enough of a fuss for them to see that it's an
> > issue for you.

> what really won't wash in the .NET era is assuming that there is a .NET era.
> it will a very long time before all traces of 'old' technologies disappear.
> i agree .NET is great , but it is not everything.  assuming that you will
> always be able to operate in 100% complete islolation is naive to an
> extreme.

And so in the meantime you have legacy apps, etc, sure. But any
component vendor who is still treating this as "not an issue" has a
tough ride ahead of them.

Quote:
> > Depending on the type of component, you might also consider the wrapper
> > idea I mentioned in another post. I had to write something similar
> > recently. I was using a library which *should* have worked in both VB
> > and VC++, but mysteriously failed in VC++. Even the vendor's sample app
> > failed (which did make me wonder somewhat about their QA department...)
> > In the end I had to write a small VB COM wrapper where each method just
> > called the "real" one. I then wrote most of the app in VC++ as normal.
> > Ugly, but it worked. Whether or not something similar is appropriate
> > depends very much on the case in point though.

> so in the end my original point was valid and your solution was very naive
> as obviously you yourself have run into the same situation and decided to
> make do with a 'daft' component by simply switching langauges.

I had to switch languages for a *minimal* amount of code, which is the
important thing.

Let's just say that my solution is one to at least attempt - in some
cases it clearly won't work (if there really *isn't* another component)
but in those cases the vendor should at least be informed that this is
an issue. If they decide to lock you in, then sure, you're locked in and
need to potentially use a "legacy" language. (Legacy in quotes because a
company wishing to move to C# will no doubt move things over as and when
they can. It doesn't need to all be in one go.)

Quote:
> i thought about this wrapper idea but decided that it was way too much
> hassle , especially considering that the real differences between c# and
> vb.net are so slight.
> it was much quicker and infinitely cleaner just to move the whole project
> into vb.net.

That depends on the situation, of course. Sometimes it will be the best
solution. Sometimes it won't. As I asked Kevin, what do you do when the
library decides to reboot your machine randomly? Is that enough of an
issue to make you look elsewhere for a different library? In *some*
circumstances, that may be a slighter issue than being forced to use a
particular language to interface with a library.

--

http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too



Mon, 28 Mar 2005 23:30:23 GMT  
 What can I do with C#, that I can't do with VB.Net ?
Quite a lot and if you think I am not answering your question properly.
Look out for my article on just this topic in MSDN AA Net Alliance in
the near future.

with regards,

J.V.Ravichandran

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Tue, 29 Mar 2005 00:45:09 GMT  
 What can I do with C#, that I can't do with VB.Net ?


Quote:

> > i thought about this wrapper idea but decided that it was way too much
> > hassle , especially considering that the real differences between c# and
> > vb.net are so slight.
> > it was much quicker and infinitely cleaner just to move the whole
project
> > into vb.net.

> That depends on the situation, of course. Sometimes it will be the best
> solution. Sometimes it won't. As I asked Kevin, what do you do when the
> library decides to reboot your machine randomly? Is that enough of an
> issue to make you look elsewhere for a different library? In *some*
> circumstances, that may be a slighter issue than being forced to use a
> particular language to interface with a library.

Gerry has already said that there is no alternative component so presumably
he has already looked elsewhere.


Tue, 29 Mar 2005 01:22:54 GMT  
 What can I do with C#, that I can't do with VB.Net ?


Quote:

> > > "Get better components" is the one which comes to mind, I'm afraid. If
> > > you use daft libraries which don't tell you what they return properly,
> > > you just *won't* be able to do safe compile-time type checking
> > > (obviously!).

> > And that is a daft answer that just evades the issue. What if this
component
> > is the only, or best, one that meets the client's requirements, even
though
> > it's design may be less than perfect? What should the client do? Rewrite
it
> > from scratch? Perhaps they cannot afford to do that. Spend 2 years
waiting
> > for another company to provide a better component? Perhaps they cannot
> > afford to do that either.

> Then you have a problem. You can take one of three unpalatable routes:

> o Write C# code which is full of casts
> o Rewrite the library
> o Use VB against the company policy (or whatever else is saying to use
>   C#)

> One potential alternative which *might* be more palatable would be to
> write some a .NET component which wrapped the library up in a better
> API. That may or may not be possible depending on the component.

> Seriously though - is "get a better library" always a daft answer? What
> about other flaws, such as: "It reboots the machine once a month,
> unpredictably"? All of the rest of your criteria might still be met. I
> don't think that looking for a better library is a daft answer, to be
> honest.

Jon,

What I meant was that your answer missed the point. It sidestepped the issue
of how to deal with Object convenienetly using C#. As Gerry says below,
suppose using this component is what he's stuck with and, apart from its use
of Object, everything else is OK. Then if it's more convenient to access it
from VB that may be the thing to do if C# can't do it as easily.



Tue, 29 Mar 2005 01:16:01 GMT  
 What can I do with C#, that I can't do with VB.Net ?

Quote:

> What I meant was that your answer missed the point. It sidestepped the issue
> of how to deal with Object convenienetly using C#.

Ah yes, it certainly sidestepped that point...

--

http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too



Tue, 29 Mar 2005 02:27:54 GMT  
 
 [ 25 post ]  Go to page: [1] [2]

 Relevant Pages 

1. can this be done using C# in .NET?

2. Determining what canned preprocessor symbols are available

3. Beginner [Q] Using Canned File Open/Save dialog

4. Help with compiling a "canned" program

5. Canned Dialogs

6. Eval of doing large project in VB or MFC

7. What is the common methjod of doing this in C#

8. Doing .NET with C++

9. Creating a Virtual directory through a program as done by VS.NET IDE

10. anyone doing professional .net development in nyc?

11. Another VB.net script I'd like to convert to C#

12. Threading problem. I'm doing something wrong

 

 
Powered by phpBB® Forum Software