-2

want to create an add method to add movies without any limitation however I don't want to use List and what i have used in this code is that i have used array and vector but it is limited i don't want it to be limited

I expect it to be added every time I add a movie as many times as the user add movies so please come with advice

i am a student and this is not okay for me to use : dynamic lists (e.g. "List"), which have built-in functions for sorting etc. You should instead only use vectors/arrays for pedagogical purposes

this is what i have used:

class Program { static Movie[] movieArray = new Movie[1000]; static int movieCount = 0;

Niklas
  • 11
  • 1
  • 4
    Don't try to avoid moderation. – Rodrigo Rodrigues Feb 28 '23 at 15:17
  • 1
    See [How do I ask and answer homework questions](https://meta.stackoverflow.com/questions/334822/how-do-i-ask-and-answer-homework-questions). Notably the part about **Make a good faith attempt to solve the problem yourself first.** and **Ask about specific problems with your existing implementation**. Your current question reads as "Please do my homework for me!". – JonasH Feb 28 '23 at 15:22
  • "I'm feeling frustrated that I didn't receive an answer or advice to my previous question, and it was closed without a response. I understand that sometimes questions go unanswered for various reasons, but I would appreciate it if those who can answer my question could be given a chance to do so. Thank you for your understanding – Niklas Feb 28 '23 at 15:25
  • You should post your effort and ideas, and how far you got by yourself. Or at least the clear requirements of the assignment. This is a coding Q/A forum, not a platform to do your homework for free. – Rodrigo Rodrigues Feb 28 '23 at 15:27
  • I think the task is to reimplement something like `Array.Resize()` then fill the newly created space. – Firo Feb 28 '23 at 15:30
  • Please add the code you already have to the question as a starting point. – Firo Feb 28 '23 at 15:33
  • 1
    Use the [Array.Resize(T\[\], Int32) Method](https://learn.microsoft.com/en-us/dotnet/api/system.array.resize). Best practice is to double the size of the array when you run out of space. – Olivier Jacot-Descombes Feb 28 '23 at 15:41
  • i Used Array.Rezie () and it worked well Thanks @Firo and others for suggestions – Niklas Mar 02 '23 at 09:28

1 Answers1

-1

BY using SYstem.LINQ, you can use:

array.Append("value");

This will add the value to the end of your array

emuller
  • 5
  • 3
  • I have used someting like This : class Program { static Movie[] movieArray = new Movie[1000]; static int movieCount = 0; – Niklas Feb 28 '23 at 15:28
  • Welcome to StackOverflow, @emuller. You could elaborate more on your answer, and why this is a good option for the OP. As he mentioned in the post, he is a student and it is an exercise with pedagogical purposes. There is nothing pedagogical in the answer. – Rodrigo Rodrigues Feb 28 '23 at 15:29
  • 1
    This line alone will do nothing because it returns a new enumerable. – Firo Feb 28 '23 at 15:32
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 04 '23 at 16:52