.NET Concurrency Model September 15, 2015
Go's concurrency model is way ahead of .NET's (Go is way ahead of .NET). But I have been doing a lot of Go concurrency and try to write comparable code in C#.
I tried to replicate the Go concurrency model as demonstrated by my previous post, Software Design and Go. However, the outcome is not as pretty. I say Go concurrency model as it was made most obvious to me from a talk I watched given by Rob Pike, one of the designers of Go. Obviously as a language design decision, Go has channels for communicating between concurrent processes. .NET, as far as I'm aware, does not have this exactly. What it does have is a set of specialized concurrent collections that you can use for passing data between threads. This seems to work.
But, as you might imagine, the syntax is much more verbose. 208 lines vs. 171 lines. 6,946 bytes vs. 3,652 bytes (C# vs Go respectively).
Here is a taste of what the C# program looks like. Obviously the bulk of it has been trimmed, but the meat is here: