Open
Conversation
Owner
prashant1shukla
commented
May 11, 2024

added 4 commits
May 10, 2024 04:15
sanchit203
reviewed
May 22, 2024
There was a problem hiding this comment.
Should have created separate class for ListOperation and DictionaryOperation
Comment on lines
+19
to
+26
| Console.WriteLine("Please enter a number from the given menu:"); | ||
| Console.WriteLine("1. Add an element to the List."); | ||
| Console.WriteLine("2. Print all the elements present in the List."); | ||
| Console.WriteLine("3. Delete the last element from the List."); | ||
| Console.WriteLine("4. Delete the first element from the List."); | ||
| Console.WriteLine("5. Delete the middle element from the List."); | ||
| Console.WriteLine("6. Calculate the average of the elements present in the List."); | ||
| Console.WriteLine("7. Exit the application."); |
There was a problem hiding this comment.
Where are the dictionary operaitons????
| { | ||
| case "1": | ||
| Console.Write("Enter a number to add to the List: "); | ||
| int numToAdd = Convert.ToInt32(Console.ReadLine()); |
There was a problem hiding this comment.
what if i enter 'a' in the console will it be converted? Or will it throw an error. Also did you looked into int.TryParse()?
| Console.Write("Enter a number to add to the List: "); | ||
| int numToAdd = Convert.ToInt32(Console.ReadLine()); | ||
| list.Add(numToAdd); | ||
| Menu(); |
There was a problem hiding this comment.
you are calling the Menu function again.. that means for every operation I will be creating another stack of function call... could have use a while(true) loop
| break; | ||
| case "2": | ||
| Console.WriteLine("Elements in the List:"); | ||
| foreach (var num in list) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.