| | |
Benefits of data typing
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
0
#2 28 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 27 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; 27 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 2008 access add advanced application array assignment basic beginner box browser button buttons center click client code combo convert cpu cuesent data database datagrid datagridview datetimepicker designer dissertation dissertations dissertationtopic eclipse editvb.net employees excel exists filter forms function html images isnumericfuntioncall listview map mobile module msaccess mssqlbackend mysql net number open page pan panel pdf picturebox picturebox2 port position print printing printpreview read record regex reuse right-to-left save search serial settings socket sorting sqldatbase sqlserver storedprocedure temp textbox timer timespan transparency txttoxmlconverter usercontol vb vb.net vba vbnet vista visual visualbasic visualbasic.net visualstudio.net web winsock wpf wrapingcode xml year






