Composite Struct : Struct definition : Struct C# Examples


C# Examples » Struct » Struct definition »

 

Composite Struct









    
struct  StructWithNoMembers
{
}
      
struct  StructWithMembers
{
        short  s;
        int  i;
        long  l;
        bool  b;
}
      
struct  CompositeStruct
{
        StructWithNoMembers  a;
        StructWithMembers  b;
        StructWithNoMembers  c;
}
      
class  SizeofCustomTypesApp
{
        unsafe  public  static  void  Main(string[]  args)  
        {
                Console.WriteLine("sizeof  StructWithNoMembers  structure  =  {0}",  sizeof(StructWithNoMembers));
                Console.WriteLine("sizeof  StructWithMembers  structure  =  {0}",sizeof(StructWithMembers));
                Console.WriteLine("sizeof  CompositeStruct  structure  =  {0}",  sizeof(CompositeStruct));
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Struct
» Struct definition