Conclusion

Conclusion

As you can see, strong typing is mandatory for all variables in Visual Basic .NET. Enforcement of typing ensures that we know exactly what type of data will be in each variable (which reduces bugs) and that we can optimize memory by using the smallest size data type for the job. Rather than using an Object data type to hold a character, we can use the right data type for the job. To all of you pros, this approach is simply common sense.

Reference data types contain a pointer that references another location in memory. This referenced location might contain a large object, a string, or some other data. We can have several reference data types pointing to the same memory location. Changes to anything in that location are reflected in all variables referencing that memory location.

Value types, on the other hand, are primitive types, which contain a data type whose size is known ahead of time, such as an integer. Since an integer will always be 4 bytes, the common language runtime can map the 4-byte memory location that will hold a value. In other words, there is no need to reference another memory location to hold an unknown size variable.

Visual Basic .NET variables are strong typed; each must be dimensioned using the As clause, such as Dim iInteger AS integer. While some programmers might see this step as unnecessary rigor, most will see strong typing as just good programming.



Coding Techniques for Microsoft Visual Basic. NET
Coding Techniques for Microsoft Visual Basic .NET
ISBN: 0735612544
EAN: 2147483647
Year: 2002
Pages: 123
Authors: John Connell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net