sizeof.blog

Golang from a .Net Dev Perspective - Part 1

As a .NET developer with ~10 years of experience in C#, I’ve recently started learning Golang.

At first, Go looks like a very different — no classes, no LINQ, no inheritance, no different kinds of loops. But once you get past the initial culture shock, you start to understand it.

In this series, I’ll break down Go from a .NET developer's point of view — mapping familiar concepts, highlighting differences, and hopefully making the learning curve smoother for others like me.

Why Learn Go as a .NET Developer?

  • Simplicity: Go prides itself on being simple, fast to compile, and easy to reason about - still trying to figure it out.

  • Concurrency built-in: Goroutines and channels offer elegant concurrency primitives.

  • Cross-platform binaries: Compiles into a single executable. No runtime, no dependencies.

  • Just for Fun: Learning something new is fun and Go is quite different from what we're used to in the .NET world.

Key Differences

Concept / Feature C# (.NET) Go
Syntax Rich syntax with many keywords and constructs (e.g., foreach, async, var, using) Minimalist syntax, fewer keywords and constructs
Classes & Inheritance Supports classes, records, structs, inheritance, abstract classes No classes or inheritance — only structs & interfaces
Structs Value types with optional methods Core type for composition, commonly used
Interfaces Explicitly implemented Implicit implementation (duck typing)
Generics Mature and feature-rich Introduced in Go 1.18, more limited but improving
LINQ / Querying Built-in LINQ support for querying collections No LINQ — use loops and helper functions
Loops for, foreach, while, do-while Only for loop with multiple styles supported
Error Handling Exceptions, try/catch/finally Error is a value (no exceptions), handled explicitly
Access Modifiers public, private, protected, internal Exported if capitalized (e.g., Name is public)
Async/Await Built-in support for asynchronous programming Uses goroutines and channels for concurrency
Compilation Compiles to IL (Intermediate Language) + runtime needed Compiles to a native static binary
Project Structure Solutions, projects, packages Packages and modules, single-binary philosophy
Package Manager NuGet go mod (built-in module system)
Reflection Powerful and widely used Limited and discouraged for most use cases

Next

In the next blog, we'll go through the differences.

Cheers 👯‍♀️