| | |
Benefits of data typing
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
0
#2 Nov 10th, 2009
One of the key benefits of type casting is that you know how the compiler will treat your variables. In the classic example:
Some compilers would treat both variables as strings and concatenate them so x+y="537" whilst others would convert the string to an integer and result in x+y=42.
By defining types you know exactly what type of data is stored and how it is treated. It is also more efficient since the memory assigned to the variable will be sized according to the data it will hold, so smaller data types will take up less memory.
VB.NET Syntax (Toggle Plain Text)
var x = 5 var y = "37" var z = x + y
Some compilers would treat both variables as strings and concatenate them so x+y="537" whilst others would convert the string to an integer and result in x+y=42.
By defining types you know exactly what type of data is stored and how it is treated. It is also more efficient since the memory assigned to the variable will be sized according to the data it will hold, so smaller data types will take up less memory.
Please don't take for granted the work that solvers do for you. Take the time to fully understand the code they give you so that you might adapt it to future problems.
"Learning is more than absorbing facts, it is acquiring understanding.” - William Arthur Ward
"Learning is more than absorbing facts, it is acquiring understanding.” - William Arthur Ward
0
#3 Nov 11th, 2009
How much ever space you need to store your data you require that much memory and datatypes gives you different amount of memory so you can choose based on your requirements.
Take a look at this article - http://en.wikipedia.org/wiki/Data_type
Take a look at this article - http://en.wikipedia.org/wiki/Data_type
Last edited by adatapost; Nov 11th, 2009 at 2:46 am.
![]() |
Other Threads in the VB.NET Forum
- Previous Thread: Error in vb application: Argument Null Exception was unhandled.
- Next Thread: Synchronise time with remote time server
Views: 218 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
"crystal .net .net2005 30minutes 2005 2008 access application arithmetic array basic binary bing button buttons c# center check code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dll dropdownlist error excel file-dialog folder ftp google hardcopy highlighting image images inline listview login math mobile ms navigate net networking opacity output peertopeervideostreaming picturebox picturebox1 plugin port print printing problem problemwithinstallation project reports" save savedialog searchbox serial server soap sorting sql string syntax tcp text textbox timer toolbox trim updown upload usercontrol vb vb.net vb.netcode vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web wpf






