Your team should decide on a style and use things like
.editorconfig
to enforce consistency within the code base. It's often a good idea to start with a baseline of recommendations commonly accepted for the language you're using. For example, Putting
{
on the same line as if/else, while common in Java/JavaScript, is less idiomatic in C#. You may want to try
codereview.stackexchange.com and let people give you a variety of suggestions. For example, you could reduce nesting by inverting your conditions, and leverage TryGetValue for better performance. —
StriplingWarrior 10 secs ago