Would anyone be able to help explain to me how this program works? - C#