© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
12 replies
Mikaeldef

Can I add elements to an array while running the code?

Hi there! Bashing my head in with my beginner C# assignment. From the instructions they want us to
Create a program that allows the user to select these options via a menu.
- Enter the name and age of a user-defined number of family members.
- Print the stored family members in the console
- Print the sum of the ages of the added family members
- Print the average age of the added family members in the console
o The average age should be printed to two decimal places, for example, 37.29.
- Be able to choose to exit the program

The data entered by the user should be stored using appropriate data types and data structures. In this assignment, you should also use an array to store the names of the family members and an array to store the ages.

The problem I'm having is with the array part. From what I've seen on the internet a List would be better for this. Is there something I'm missing?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

code builds but hangs while running
C#CC# / help
16mo ago
How to replace elements in an array of type T?
C#CC# / help
3y ago
Linking a WPF grid to an array in the code behind
C#CC# / help
7mo ago