I started coding a program to parse the .csv formatted data from the Sharp into a tab delimited format. I had the following observations as I was coding:
- Even though most C# programmers I’ve learned from have been declaring variables inline, like ‘string text = “textdata”‘ at line 20 in main, it’s better for declarations to stay in the first lines of the function
- I started moving my code into subroutines, and it seems there can be advantages and disadvantages to certain syntax in subroutines. File IO functions seem to be an extreme case, as a subroutine doing file io has the advantage of being unlikely to lose much data if problems occur, but adds a large overhead when it’s called so frequently. Any thoughts on weighing the pros/cons of this one?