473,408 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Option strict require more casting?

I find there is more casting required in C# than VB.NET. If Option
Strict/Explicit is turned on, will this basically create the same
environment as C# - uppercase, more casting required, must build event
handlers?

Thanks,
Brett
Nov 21 '05 #1
6 1558
Brett,

No Option Strict does not make from VBNet a kind of C#. To answer you direct
on your lower/uppercase question. The distinct between uppercase and
lowercase is not CLS compliant. However when used in private values in C
languages no problem.

With option strict on, the casting is exactly the same. However by instance
unsafe code is still not possible with VBNet, while in there stays
background compiling to help you direct with errors and auto complete what
is not in C#.

I hope this helps,

Cor
Nov 21 '05 #2
The only thing it will do is require you to declare your variables and
perform the casts. It does not affect the way event handlers are hooked up
for you (static or dynamic) and has no affect on case sensitivity. It is
highly recommended to Set Explicit ON and Set Option Strict ON for any new
VB.NET project. You may need to set them off when converting old VB6 code or
if you are doing late binding and you know what you are working with.

HTH,
-B

"Brett" <no@spam.com> wrote in message
news:uu**************@TK2MSFTNGP15.phx.gbl...
I find there is more casting required in C# than VB.NET. If Option
Strict/Explicit is turned on, will this basically create the same
environment as C# - uppercase, more casting required, must build event
handlers?

Thanks,
Brett

Nov 21 '05 #3
VB with Option Strict On is actually *more* strict than C#, believe it or
not. That is, C# will let you get away with a lot more implicit casting than
VB with option strict on.

David Anton
www.tangiblesoftwaresolutions.com
Home of the Instant C# VB.NET to C# converter
and the Instant VB C# to VB.NET converter

"Brett" wrote:
I find there is more casting required in C# than VB.NET. If Option
Strict/Explicit is turned on, will this basically create the same
environment as C# - uppercase, more casting required, must build event
handlers?

Thanks,
Brett

Nov 21 '05 #4
Well i have some different thoughts about this
I set Option explicit and Option strict on by default above every code
block and not default in the project cause in some circumstances option
explicit is more a pain in the but and i want to have control over it where
to use it or not

when would i not use option strict ???
Well those of you ever involved in writing a remoting project or writing
there own proxy class for webservices will know why ,,,,, cause there are
situations where late binding is actually handy
and it sure is not bad to use it ... that is why remoting is so much
easier to acomplish in VB as in C#

happy coding

M. Posseth [MCP Developer]

"Beth Massi [Architect MVP]" <bm****@comcast.net> wrote in message
news:eo**************@TK2MSFTNGP10.phx.gbl...
The only thing it will do is require you to declare your variables and
perform the casts. It does not affect the way event handlers are hooked up
for you (static or dynamic) and has no affect on case sensitivity. It is
highly recommended to Set Explicit ON and Set Option Strict ON for any new
VB.NET project. You may need to set them off when converting old VB6 code or if you are doing late binding and you know what you are working with.

HTH,
-B

"Brett" <no@spam.com> wrote in message
news:uu**************@TK2MSFTNGP15.phx.gbl...
I find there is more casting required in C# than VB.NET. If Option
Strict/Explicit is turned on, will this basically create the same
environment as C# - uppercase, more casting required, must build event
handlers?

Thanks,
Brett


Nov 21 '05 #5
I agree. That's why I said you may want to set Option Strict Off if you are
doing late binding. Like it comes in handy when you have to write a lot of
Reflection code too. You just need to be really careful because potential
errors won't spring up until runtime.

"M. Posseth" <mi*****@nohausystems.nl> wrote in message
news:d5**********@reader08.wxs.nl...
Well i have some different thoughts about this
I set Option explicit and Option strict on by default above every code
block and not default in the project cause in some circumstances option
explicit is more a pain in the but and i want to have control over it
where
to use it or not

when would i not use option strict ???
Well those of you ever involved in writing a remoting project or writing
there own proxy class for webservices will know why ,,,,, cause there are
situations where late binding is actually handy
and it sure is not bad to use it ... that is why remoting is so much
easier to acomplish in VB as in C#

happy coding

M. Posseth [MCP Developer]

"Beth Massi [Architect MVP]" <bm****@comcast.net> wrote in message
news:eo**************@TK2MSFTNGP10.phx.gbl...
The only thing it will do is require you to declare your variables and
perform the casts. It does not affect the way event handlers are hooked
up
for you (static or dynamic) and has no affect on case sensitivity. It is
highly recommended to Set Explicit ON and Set Option Strict ON for any
new
VB.NET project. You may need to set them off when converting old VB6 code

or
if you are doing late binding and you know what you are working with.

HTH,
-B

"Brett" <no@spam.com> wrote in message
news:uu**************@TK2MSFTNGP15.phx.gbl...
>I find there is more casting required in C# than VB.NET. If Option
>Strict/Explicit is turned on, will this basically create the same
>environment as C# - uppercase, more casting required, must build event
>handlers?
>
> Thanks,
> Brett
>



Nov 21 '05 #6

Then we speak the same Language :-)

"Beth Massi [Architect MVP]" <bm****@comcast.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I agree. That's why I said you may want to set Option Strict Off if you are doing late binding. Like it comes in handy when you have to write a lot of
Reflection code too. You just need to be really careful because potential
errors won't spring up until runtime.

"M. Posseth" <mi*****@nohausystems.nl> wrote in message
news:d5**********@reader08.wxs.nl...
Well i have some different thoughts about this
I set Option explicit and Option strict on by default above every code
block and not default in the project cause in some circumstances option explicit is more a pain in the but and i want to have control over it
where
to use it or not

when would i not use option strict ???
Well those of you ever involved in writing a remoting project or writing
there own proxy class for webservices will know why ,,,,, cause there are situations where late binding is actually handy
and it sure is not bad to use it ... that is why remoting is so much
easier to acomplish in VB as in C#

happy coding

M. Posseth [MCP Developer]

"Beth Massi [Architect MVP]" <bm****@comcast.net> wrote in message
news:eo**************@TK2MSFTNGP10.phx.gbl...
The only thing it will do is require you to declare your variables and
perform the casts. It does not affect the way event handlers are hooked
up
for you (static or dynamic) and has no affect on case sensitivity. It is highly recommended to Set Explicit ON and Set Option Strict ON for any
new
VB.NET project. You may need to set them off when converting old VB6
code or
if you are doing late binding and you know what you are working with.

HTH,
-B

"Brett" <no@spam.com> wrote in message
news:uu**************@TK2MSFTNGP15.phx.gbl...
>I find there is more casting required in C# than VB.NET. If Option
>Strict/Explicit is turned on, will this basically create the same
>environment as C# - uppercase, more casting required, must build event
>handlers?
>
> Thanks,
> Brett
>



Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Microsoft News | last post by:
I have a project that was created all with Option Strict OFF. Works great, not a problem with it. But if I turn Option Strict ON then I get a LOT of errors. My question, should I even care...
1
by: fabrice | last post by:
Hello I have a little problem with casting in a Datagrid Control. I'm using Option Strict in my web application. In a Template Column, I put in an ImageButton Control with a Command...
8
by: Nathan | last post by:
Hi, I have an operation in which I divide one integer by another and assign the result to a third integer. However, I get the error message: "Option Strict On disallows implicit conversions...
13
by: Shannon Richards | last post by:
Hello: I have a problem using ByRef arguments with Option Strict ON. I have built a generic sub procedure "ChangeValue()" to change the value of an argument if the new value is not the same as the...
30
by: Microsoft News | last post by:
I have a project that was created all with Option Strict OFF. Works great, not a problem with it. But if I turn Option Strict ON then I get a LOT of errors. My question, should I even care...
1
by: m830266 | last post by:
I'm trying to use the APAX serial I/O control (www.turbocontrol.com/AProZilla.htm) in a VB.NET project and I'm having trouble with its 'data received' events. The data is supplied by APAX as a...
15
by: guy | last post by:
when i first started using .net (beta 1) i came across option strict and thought hey this could be really good, and since then have always turned it on, most people here seem to agree that this is...
8
by: Rory Becker | last post by:
A wise man once said: "Never put off until runtime what you can fix at compile time." Actually I think he said it about 10 minutes before I started this post. I am a firm believer, like the...
8
by: =?Utf-8?B?R3JlZw==?= | last post by:
We have an application in our office that has the Option Strict option set to off right now. I do understand it should be set to ON, but right now, I'm just going to continue with it this way since...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.