Login
Register
Tutorials
Forum
Career Development
Resources
Reviews
Jobs
Interview
Communities
Projects
Training
Silverlight Games
|
Bookmarks
|
New Members FAQ
|
Mentor
|
Code Converter
|
IT Companies
|
Peer Appraisal
|
Members
|
Revenue Sharing
|
Computer Jokes
|
New Posts
|
Social
|
Talk to Webmaster Tony John
Online Members
naveensanagasetti
saisagar
Manick
More...
Resources
»
.NET programming
»
Visual Studio
What is the need of Option Strict On in VB.NET ?
Posted Date:
30-May-2012
Category:
Visual Studio
Author:
Preethu
Member Level:
Silver
Points
: 7
The advantage of using OPTION STRICT ON is that it makes the code strongly typed. So it allows implicit data conversions for widening conversions only. Thus it results in no data loss. Also, conversion between numeric types and strings are also avoided
Use of Option Strict On
When programming in VB.NET, you should always do OPTION STRICT ON.
By default, VB.NET has OPTION STRICT OFF. So the program will do implicit type conversions and late bindings which leads to performance problems and run-time errors. Also, it will be difficult to understand the code later on. So it is a sub standard programming practice.
The advantage of using OPTION STRICT ON is that it makes the code strongly typed. So it allows implicit data conversions for
widening conversions
only. Thus it results in no data loss. Also, conversion between numeric types and strings are also avoided
Widening Conversions
Widening conversions
means...
Byte can be converted to Byte, Short, Integer, Long, Decimal, Single, Double
Short can be converted to Short, Integer, Long, Decimal, Single, Double
Integer can be converted to Integer, Long, Decimal, Single, Double
Char can be converted to Char, String
and so on..
but integer cannot be converted to byte. (here, not from right to left)
How to set the option strict on in visual studio?
Go to Tools -> Options -> Projects & Solutions -> VB Defaults -> Set Option Strict On
Did you like this resource? Share it with your friends and show your love!
Tweet
Responses to "What is the need of Option Strict On in VB.NET ?"
Author:
Preethu
30 May 2012
Member Level:
Silver
Points
: 0
It speeds up the code also.
Feedbacks
Post Comment:
Notify me by email when others post comments to this article.
Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
No HTML formatting and links to other web sites are allowed.
This is a strictly moderated site. Absolutely no spam allowed.
Name:
Sign In
to fill automatically.
Email:
(Will not be published, but
required
to validate comment)
Type the numbers and letters shown on the left.
Next Resource:
How to convert xml file to Excel file (.xlsx)
Previous Resource:
How to drag and drop multiple rows from xtragrid to xtratreelist in VB.NET?
Return to Resources
Post New Resource
Category:
Visual Studio
Post resources and
earn money
!
More Resources
How to convert xml file to Excel file (.xlsx)
How to get data from DevExpress datagrid to xml file
New features in Visual Studio 2010
How Visual Studio 2010 Ultimate edition helps in team productivity?
Agile Software Development Methodology
Whats new in Visual Studio 2010 and when to use which Visual Studio 2010 edition?
Popular Tags
Tag posting guidelines
Search Tags
Need of Option Strict On
.
VB.NET
.
Active Members
Today
Anil Kumar ...
(34)
Padma
(26)
aniethacosmic
(14)
Last 7 Days
baskar
(326)
Ultimaterengan
(169)
Asheej T K
(161)
more...
Awards & Gifts
Email subscription
.NET Jobs
.NET Articles
.NET Forums
Articles Rss Feeds
Forum Rss Feeds