Smart Copy and Paste from StackOverflow–part 5 from 7

I have written this mini e-book in order to remember myself how to do it .

I will put each week a part from my book here in the blog. If you want , however, buy the book, I will do appreciate !


Copying code into the program

If it does not compile at first attempt, see if you are missing some reference / namespaces / others.

If again does not compile, repeat previous step:" searching " and take next links. Do not bother to improve the code . Codes are everywhere – and, if it is not written well, you will discover another one that is easy to copy / paste.

Verifying code

This is the tricky part. And this is the part that you should always have , if you copy paste other people code. And never test in production[1]


For sorting you can create a List<Person> with some real names, taken from your colleagues / acquaintances . Then you will pass through the sorting function and see if it function.


For this you will create 2 functions: Encrypt and Decrypt. And ensure Encrypt(Decrypt( variable )) = variable. ( Again, you can use your name or any other site url)

If again this step does not work , see if you have caused some error when coding the test. If not, repeat step:" searching " and take next links .

if the code works as needed , I think that you should add some automatic test code.





The book link is