5 Replies
Hello guys, can someone give some feedbacks about the way I code to implement what the exercises were asking for please, like adding an item/removing an item etc
I could have use a list but it's a class exercise so we must follow the template
What could I improve please, also, when I use the
default(T)
, I get the warning that T might be null, so I should always assign the default value to a variable, check if the variable is not null, then assigned to the array in this case?Sounds like a #code-review thing
What was the exercise though?
Reimplementing List<T>?
ops sorry, will post that there
euh
wait
I don't have the template but basically, I needed to implement the add method/remove method/ resize method without using any in-built array method
Anyways, some general remarks:
- If Remove fails, you'd want to throw an exception or at least return that status somehow. Writing to Console won't help the control flow of your app usually.
- It's not necessary to initialize the new array in your Resize if you end up copying things over next
Thought so yeah
ahh I see
2sec, will just repost the post in code re-view
I will just close this post, will keep in mind what you said about the remove and resize method