C# Programming/Keywords/sizeof
< C Sharp Programming < Keywords
The sizeof
keyword returns how many bytes an object requires to be stored.
An example usage:
int i = 123456;
Console.WriteLine("Storing i, a {0}, requires {1} bytes, or {2} bits.",
i.GetType(), sizeof(i), sizeof(i)*8);
// outputs "Storing i, a System.Int32, requires 4 bytes, or 32 bits."
C# Keywords | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Special C# Identifiers | ||||||||||
|
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.