Structures in C#

To define a type/structure to store several data items and variables.

struct structureName { 
   //member declarations 


Structures can be passed as function arguments (using the struct data type).

To define a specific structure declaration, use the member access operator (.).

Structures can be pointed to, similarly to pointing to variables. To access a member of the structure using pointers, the -> operator must be used.

Structure must be declared as an instance to be accessed. (struct Car car1;).

struct Car { 
   string make; 
   string model; 
   int year;

Add to Slack

< Type Conversion   |   If Statement >

© 2019 SyntaxDB. All Rights Reserved.