Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Structs with Other Data Structures | Structs & Enumerators
C# Beyond Basics

Structs with Other Data StructuresStructs with Other Data Structures

Since structs are essentially data types, we can use them for creating Arrays and Lists as well:

cs

index.cs

In a List or an Array, we would access a Student object's field using the following syntax:

cs

index.cs

For-example:

cs

index.cs

We can also loop through these arrays or lists to assign or access data. For-example the following code loops through a List of Students objects and calculates the average age:

cs

index.cs

It is clear that here the Student struct acts like a data type. We can also use Student as a dictionary value as well. Following is an example of using Struct as a value in a dictionary:

cs

index.cs

What is the correct syntax for accessing the score attribute of the 1st player?

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

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

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

Зміст курсу

C# Beyond Basics

Structs with Other Data StructuresStructs with Other Data Structures

Since structs are essentially data types, we can use them for creating Arrays and Lists as well:

cs

index.cs

In a List or an Array, we would access a Student object's field using the following syntax:

cs

index.cs

For-example:

cs

index.cs

We can also loop through these arrays or lists to assign or access data. For-example the following code loops through a List of Students objects and calculates the average age:

cs

index.cs

It is clear that here the Student struct acts like a data type. We can also use Student as a dictionary value as well. Following is an example of using Struct as a value in a dictionary:

cs

index.cs

What is the correct syntax for accessing the score attribute of the 1st player?

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

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

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