C-Sharp code cleanup chapters 1 and 2

Minor updates to make the code more readable and consistent.