Navigating the Dotnet Landscape: Learning C# After Years of Typescript

As a software generalist, the ability to adapt to various technologies and programming languages is crucial. While I have primarily worked on TypeScript applications during my time at Atomic Object, a recent project required me to delve into the dotnet ecosystem. This shift prompted me to flex my tech-adaptation muscles.

Relating the New to the Familiar

My goal when starting the project was to enable myself to contribute as quickly as possible. My approach was to relate the new language and framework to the Typescript/Node ecosystem, which I’d come to know well. Effectively, I aimed to answer the question: How can I develop in a way that feels familiar?

Finding the Right Tools

Finding the right IDE was important since it’s the tool I work in the most. I experimented with Visual Studio but it was too clunky. I’d heard good things about Ryder but ultimately stuck with VS Code out of familiarity and comfort. The C# developer tools extension for Code is rapidly improving and the support for my other must-haves like format on save is already great!

Making it Easy to Run Locally

How to configure the local environment in dotnet was initially unclear to me. In Typescript, I was accustomed to using something dotenv to set environment variables that the app could use. After some time, I discovered that using an additional, optional appsettings JSON file named appsettings.Development.json, excluded from version control, was a straightforward method to achieve the same result with dotnet.

Figuring out Hot Reloading

Having worked on many React projects, I now expect the application to reload on save during development. This is something I’d been clamoring for on my current project. Turns out, it’s very simple to do in C#. I just run my application in the following way, and I’m good to go.

dotnet watch –target MyApp/MyApp.cs run

Running Tests in Watch mode

Having worked with Jest and Vitest quite a bit, I really like how easy they make it to run tests in watch mode. I still haven’t found anything that quite mirrors either of those tools. That said, dotnet watch has been a game-changer for the way I do TDD in C#. Similar to the command above for running the app, the following will rerun the tests on each file change:

dotnet watch –target UnitTests/MyTests.cs test

These things have been the biggest help to me thus far. I’m still learning though, and I’d love to hear from you in the comments if there are other tools I can use to improve my quality of life as a developer further.

Conversation

Join the conversation

Your email address will not be published. Required fields are marked *