Used to obtain the size in bytes for an unmanaged type. Unmanaged types include the built-in types that are listed in the table that follows, and also the following:
Enum types
Pointer types
User-defined structs that do not contain any fields or properties that are reference types
Syntax:// Constant value 4:
int intSize = sizeof(int);
Example:class MainClass
{
// unsafe not required for primitive types
static void Main()
{
Console.WriteLine("The size of short is {0}.", sizeof(short));
Console.WriteLine("The size of int is {0}.", sizeof(int));
Console.WriteLine("The size of long is {0}.", sizeof(long));
}
}
/*
Output:
The size of short is 2.
The size of int is 4.
The size of long is 8.
*/
License.
All information of this service is derived from the free sources and is provided solely in the form of quotations.
This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 280 / 159168638. Delta: 0.00267 с