Skip to main content
Code Review

Return to Answer

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

Reinventing the wheel is a useful learning exercise. However, it's worth considering what has gone before you and the environment that you're performing the exercise in. .Net provides some common interfaces that generic collection classes can implement to help them fit into the existing landscape. Consider implementing some of ICollection<T>, IEnumerable<T>, IEnumerable, ICollection, IReadOnlyCollection<T>.

This will help your list to fit in with the existing framework (so that for example collection extension methods and linq support are more straightforward). It will also help you decide on some of the methods that your class should consider implementing.

I think @Nathan has covered most points covered most points around your RemoveBefore method, which is what you were after the review for, however I'd consider throwing an exception if the provided item isn't in the list. There's also quite a lot that could be said about the rest of your code if you're looking for a full review (such as the mismatch between the locking in RemoveHead and the rest of the code).

Reinventing the wheel is a useful learning exercise. However, it's worth considering what has gone before you and the environment that you're performing the exercise in. .Net provides some common interfaces that generic collection classes can implement to help them fit into the existing landscape. Consider implementing some of ICollection<T>, IEnumerable<T>, IEnumerable, ICollection, IReadOnlyCollection<T>.

This will help your list to fit in with the existing framework (so that for example collection extension methods and linq support are more straightforward). It will also help you decide on some of the methods that your class should consider implementing.

I think @Nathan has covered most points around your RemoveBefore method, which is what you were after the review for, however I'd consider throwing an exception if the provided item isn't in the list. There's also quite a lot that could be said about the rest of your code if you're looking for a full review (such as the mismatch between the locking in RemoveHead and the rest of the code).

Reinventing the wheel is a useful learning exercise. However, it's worth considering what has gone before you and the environment that you're performing the exercise in. .Net provides some common interfaces that generic collection classes can implement to help them fit into the existing landscape. Consider implementing some of ICollection<T>, IEnumerable<T>, IEnumerable, ICollection, IReadOnlyCollection<T>.

This will help your list to fit in with the existing framework (so that for example collection extension methods and linq support are more straightforward). It will also help you decide on some of the methods that your class should consider implementing.

I think @Nathan has covered most points around your RemoveBefore method, which is what you were after the review for, however I'd consider throwing an exception if the provided item isn't in the list. There's also quite a lot that could be said about the rest of your code if you're looking for a full review (such as the mismatch between the locking in RemoveHead and the rest of the code).

Source Link
forsvarir
  • 11.8k
  • 7
  • 39
  • 72

Reinventing the wheel is a useful learning exercise. However, it's worth considering what has gone before you and the environment that you're performing the exercise in. .Net provides some common interfaces that generic collection classes can implement to help them fit into the existing landscape. Consider implementing some of ICollection<T>, IEnumerable<T>, IEnumerable, ICollection, IReadOnlyCollection<T>.

This will help your list to fit in with the existing framework (so that for example collection extension methods and linq support are more straightforward). It will also help you decide on some of the methods that your class should consider implementing.

I think @Nathan has covered most points around your RemoveBefore method, which is what you were after the review for, however I'd consider throwing an exception if the provided item isn't in the list. There's also quite a lot that could be said about the rest of your code if you're looking for a full review (such as the mismatch between the locking in RemoveHead and the rest of the code).

lang-cs

AltStyle によって変換されたページ (->オリジナル) /