4 ms·
What it would take for me to consider .NET/C# more often, is easier interop with C. I really like the way Golang does it, I know P/Invoke isn't terribly hard, b
by Meai 14y ago
What it would take for me to consider .NET/C# more often, is easier interop with C. I really like the way Golang does it, I know P/Invoke isn't terribly hard, but it's still messy and you have to muck around with attributes and annotations. In Golang I did some interop by simply pasting lines and names of header files around. That's a lot more convenient than having to decide how to layout a struct, at least that was my impression when I looked into it.
Mono documentation is very sparse as well, they basically tell you to just look for the msdn docs, which splits your efforts up and makes you uneasy whether you'll run into Mono specific things. (which there are)
- lucajona 14y agoIf Go already does C interop easily, what other factors make you want to consider using .NET instead?
- Meai 14y agoExisting API support, frameworks, libraries and IDE support.
- migueldeicaza 14y agoGenerics, iterators, functional-style programming, LINQ, asynchronous programming, dynamic, Reflection.Emit are the things that I would miss.
- jstclair 14y agoYou raise a good point: is there something like http://pinvoke.net/ http://pinvoke.net/ for non-windows interop? I know that mono is wrapping things themselves, but on open wiki might help.
- sparkie 14y agoMany open source libraries already have .Net bindings available, a quick search can discover them. They're also packaged into assemblies or made into higher level APIs, which sure beats copy-pasting from a webpage. There's the [P/Invoke interop assistant](http://clrinterop.codeplex.com/ http://clrinterop.codeplex.com/) which can help you create a wrapper for C APIs, and the mono team have created [Cxxi](https://github.com/mono/cxxi https://github.com/mono/cxxi), a binding generator for C++ APIs.