Introduction:
In this article,i am going to explain about how the value types are defined stored executed in asp.net framework.
Main:
The simplest types in the .NET Framework, primarily numeric and boolean types, are value types. Value types are variables that contain their data directly instead of containing a reference to the data stored elsewhere in memory. Instances of value types are stored in an area of memory called the stack, where the runtime can create, read, update, and remove them quickly with minimal overhead.
There are three general value types:
Built-in types
User-defined types
Enumerations
Each of these types is derived from the System.ValueType base type. The following sections show how to use these different types.
Built-In Value Types
Built-in value types are base types provided with the .NET Framework, with which other types are built. All built-in numeric types are value types. You choose a numeric type based on the size of the values you expect to work with and the level of precision you require.
The runtime optimizes the performance of 32-bit integer types (Int32 and UInt32), so use those types for counters and other frequently accessed integral variables. For floating-point operations, Double is the most efficient type because those operations are optimized by hardware.
How to Declare a Value Type Variable
To use a type, you must first declare a symbol as an instance of that type. Value types have an implicit constructor, so declaring them instantiates the type automatically; you don’t have to include the New keyword as you do with classes. The constructor assigns a default value (usually null or 0) to the new instance, but you should always explicitly initialize the variable within the declaration, as shown in the following code block:
' VB
Dim b As Boolean = False
// C#
bool b = false;
' VB
Dim b As Boolean = False
// C#
bool b = false; |
Keyword Differences in Visual Basic and C#
One of the cosmetic differences between Visual Basic and C# is that Visual Basic capitalizes keywords, whereas C# uses lowercase keywords. In the text of this book, Visual Basic keywords always are capitalized for readability. Code samples always include separate examples for Visual Basic and C#.
Visit Main Article,
http://aspdotnetcodesonline.com/asp-net/declaring-working-using-value-structure-types-asp-net-c-stack/
Conclusion:
Hope this helps,
Happy coding.