Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
What are Structs? | Structs & Enumerators
course content

Зміст курсу

C# Beyond Basics

What are Structs?What are Structs?

Structs, also known as Structures, are similar to Dictionaries, however, in structs we have some predefined Fields (also called Attributes) instead of Keys. Each Field can be of a different data type.

When we define a Struct, we define a blueprint or format for storing some data - hence a Struct itself cannot hold any data however, using the Struct, we can create objects (also known as instances) of that structure, which can store data in the format provided by the structure. Following is an illustration of a Struct with its Objects:

Using a Struct we can create as many objects as we want. This makes it easy to store related data in an organized format.

It is important to note that the structure itself cannot hold data since it's only a blueprint, however the objects we create using it are capable of storing data.

1. Which statement is correct?
2. Can a struct hold data on its own without creating instances?

Which statement is correct?

Виберіть правильну відповідь

Can a struct hold data on its own without creating instances?

Виберіть правильну відповідь

Все було зрозуміло?

Секція 2. Розділ 1
course content

Зміст курсу

C# Beyond Basics

What are Structs?What are Structs?

Structs, also known as Structures, are similar to Dictionaries, however, in structs we have some predefined Fields (also called Attributes) instead of Keys. Each Field can be of a different data type.

When we define a Struct, we define a blueprint or format for storing some data - hence a Struct itself cannot hold any data however, using the Struct, we can create objects (also known as instances) of that structure, which can store data in the format provided by the structure. Following is an illustration of a Struct with its Objects:

Using a Struct we can create as many objects as we want. This makes it easy to store related data in an organized format.

It is important to note that the structure itself cannot hold data since it's only a blueprint, however the objects we create using it are capable of storing data.

1. Which statement is correct?
2. Can a struct hold data on its own without creating instances?

Which statement is correct?

Виберіть правильну відповідь

Can a struct hold data on its own without creating instances?

Виберіть правильну відповідь

Все було зрозуміло?

Секція 2. Розділ 1
some-alt