STRUCTURE
PUBLISHED: 9/28/2023
Last updated
PUBLISHED: 9/28/2023
Last updated
STRUCTURE (Struct)--> a data type that allows the creation of a single variable that can store different types of related data
In C#, a structure, also known as struct, is a data type that falls into the 'value type' category. It allows you to create a single variable that can store different types of related data. To create one of these structures, we use a keyword called 'struct'.
OBJECTIVE: Create a structure to store data on movies.
The data to be stored are: -> Title -> Genre -> Year Released
OBJECTIVE: Use the struct Movies
to add 3 movies to the movie database and define the necessary data.
A struct cannot contain a parameterless constructor, it can only contain parameterized constructors or static constructors.
To use constructors within a structure you must include ALL members of the struct
in the parameterized constructor and assign parameters to members.
OBJECTIVE: With the use of constructors, add 3 more movies to the database.