| | |
Benefits of data typing
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
0
#2 31 Days Ago
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 30 Days Ago
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; 30 Days Ago 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
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account arithmetic array arrays basic bing button buttons c# center check checkbox code combobox convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog filter ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor ms net networking objects output panel passingparameters picturebox picturebox1 port position print printing problem project read remove save searchbox searchvb.net select serial server shutdown soap sorting survey table tcp temperature text textbox timer timespan toolbox trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio2008 web winforms wpf year






