Weekly Challenge: Copying Objects in C#


Challenge Page (with solution):
Subscribe to Solutions:

Practice makes perfect, right? Well, mostly, but practice is very important. This series is all about getting you to practice the things you learn. I would encourage you to do every one. See which ones are just easy refreshers and which ones are difficult learning experiences.


Xem Thêm Bài Viết Khác:https://wijstaanvooronzegrondrechten.org/cong-nghe


  1. Hi Tim, I really like your course and the way you teach, do you have or are you working on TGOF Design Patterns? I would love to learn that with real world samples. You have one sure buyer/payee here if you have that course. Thanks and more power to you.

  2. Six lines of new code to achieve the bonus task (plus a little decorating) and I learned something about generics as well! Thank you Stack Overflow.

    The first attempt was not so succinct though. Still, it worked.

  3. I wish I could use some kind of SPOILER tag here. This way I could tell you about my solutions and hide it at the same time 😉
    Anyways, you didn't say how different should be second solution for bonus part. There is one best practice when it comes to copying objects: always place copying code inside the object which know itself better. It could be object copying another or the one being copied. I assume you've already guessed what two programming elements I used. Thanks, programming is fun 🙂

  4. This one was hard for me!… but i've made it work. Tim, is there any problem if we share some of our solutions here (Via dotnetfiddle.net), it will be nice to see what other ppl came up with!

  5. I know what concept is behind this exercise, but really nice one, because that's an important concept regarding implementation of "copying" stuff…


Please enter your comment!
Please enter your name here