Click here to Skip to main content
15,914,444 members
Home / Discussions / C#
   

C#

 
AnswerRe: Size of a Class Pin
stancrm8-Sep-08 0:44
stancrm8-Sep-08 0:44 
GeneralRe: Size of a Class Pin
San8-Sep-08 1:10
San8-Sep-08 1:10 
GeneralRe: Size of a Class Pin
N a v a n e e t h8-Sep-08 1:15
N a v a n e e t h8-Sep-08 1:15 
GeneralRe: Size of a Class Pin
Mark Salsbery8-Sep-08 7:10
Mark Salsbery8-Sep-08 7:10 
AnswerRe: Size of a Class Pin
JoeSharp8-Sep-08 0:45
JoeSharp8-Sep-08 0:45 
GeneralRe: Size of a Class Pin
San8-Sep-08 1:08
San8-Sep-08 1:08 
GeneralRe: Size of a Class Pin
Colin Angus Mackay8-Sep-08 2:03
Colin Angus Mackay8-Sep-08 2:03 
AnswerRe: Size of a Class [modified] Pin
Guffa8-Sep-08 1:25
Guffa8-Sep-08 1:25 
San wrote:
I need to get the size of the class.


Why?

IIRC, a class like that would use 20 bytes on a 32 bit system and 28 bytes on a 64 bit system. Each object consists of two pointers plus the instance data.

As you see, the size differs depending on the version of the CLR (which determines the memory layout). Also, you have a pretty simple example. If you have members of different data types, they may be aligned on an even word boundary which may add to the size, and they might get rearranged to make best use of memory when aligned. So, it might not be possible to predict exactly how large the object can be.

Despite everything, the person most likely to be fooling you next is yourself.

modified on Monday, September 8, 2008 9:31 AM

AnswerRe: Size of a Class Pin
Mark Salsbery8-Sep-08 7:06
Mark Salsbery8-Sep-08 7:06 
Questionhow to show print preview of doc file Pin
Benetz8-Sep-08 0:20
Benetz8-Sep-08 0:20 
AnswerRe: how to show print preview of doc file Pin
Pete O'Hanlon8-Sep-08 0:28
mvePete O'Hanlon8-Sep-08 0:28 
GeneralRe: how to show print preview of doc file Pin
Benetz8-Sep-08 2:06
Benetz8-Sep-08 2:06 
GeneralRe: how to show print preview of doc file Pin
Pete O'Hanlon8-Sep-08 2:24
mvePete O'Hanlon8-Sep-08 2:24 
GeneralRe: how to show print preview of doc file Pin
Benetz8-Sep-08 2:35
Benetz8-Sep-08 2:35 
GeneralRe: how to show print preview of doc file Pin
Pete O'Hanlon8-Sep-08 3:01
mvePete O'Hanlon8-Sep-08 3:01 
QuestionHow to print whole scrolled form Pin
Miak1008-Sep-08 0:11
Miak1008-Sep-08 0:11 
AnswerRe: How to print whole scrolled form Pin
softwarejaeger8-Sep-08 0:20
softwarejaeger8-Sep-08 0:20 
Questionbmp to jpeg converter Pin
laziale7-Sep-08 23:52
laziale7-Sep-08 23:52 
AnswerRe: bmp to jpeg converter Pin
Anthony Mushrow8-Sep-08 0:10
professionalAnthony Mushrow8-Sep-08 0:10 
AnswerRe: bmp to jpeg converter Pin
stancrm8-Sep-08 0:48
stancrm8-Sep-08 0:48 
QuestionWeb Services in asp.net Pin
g_amol7-Sep-08 23:10
g_amol7-Sep-08 23:10 
AnswerRe: Web Services in asp.net Pin
AhsanS7-Sep-08 23:18
AhsanS7-Sep-08 23:18 
QuestionAdd printer [modified] Pin
arkiboys7-Sep-08 23:05
arkiboys7-Sep-08 23:05 
QuestionHow to call code behind function in JavaScript ? Pin
$unil Dhiman7-Sep-08 22:29
$unil Dhiman7-Sep-08 22:29 
AnswerRe: How to call code behind function in JavaScript ? Pin
Manas Bhardwaj7-Sep-08 22:36
professionalManas Bhardwaj7-Sep-08 22:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.