Script Formatting and Spacing when using C# (Comments and Code Lines)

This is a pretty basic question, so hopefully no one falls out of their chair when they read it.:hushed:

I have done a lot of web design and Cold Fusion projects and have always been told that you have to minify everything for better performance and speed for the websites. I am curious what everyone’s thoughts are when it comes to C#.

So for example, I will write some Jquery Scripts, place the nice and easy to read lines and have a tool get rid of all spaces which shrinks the size and of course you wouldn’t edit because its not user friendly.

When I write C# I like to have a lot of comments and spaces for reading and following my workflow.

Does it clean up all the spaces and everything when compiling automatically?
Does it not matter when writing scripts in C#, because most is on local machine and computers are so fast now?

I am working on a game, and this just popped into my head and was curious. Thanks.

C# is compiled so runtime performance is not affected by the size of the .cs files. Compile times might be slightly slower with large files but we’re talking about nanoseconds overall, so its not worth worrying about. Be as verbose as you like.

2 Likes

Thank you. Appreciate the response. One less thing to worry about.

This. The compiler does all sorts of magic. So feel free to code for human readability instead of machine readability.

1 Like