C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

size of c#


Posted Date: 29 Feb 2008      Posted By: Gaurav Agrawal      Member Level: Diamond     Points: 2   Responses: 2



what is the minimum size of an object in c#?

eg
class abc
{

}

abc obj=new abc();

size of obj?

Thanks & Regards,

Gaurav Agrawal
Sr.Software Engineer
gaur1982@yahoo.com
09829373514





Responses

Author: Jins Philip    29 Feb 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

You can't really do this using managed code.
C# provides a sizeof
operator, but only for value types.



Author: www.DotNetVJ.com    29 Feb 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

C# has a 'sizeof' operator that returns the size that a field of that type will be. Thus for reference types (class, not struct), it will always return the size of a pointer (4 on 32 bit systems). The sizeof operator can be applied only to value types, not reference types.

Thanks -- Vijaya Kadiyala
http://www.DotNetVJ.com
Microsoft MVP
Me & My Little Techie



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : what is the Control for E-Mail.
Previous : Master Pages
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use