Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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)


You raise a good point: is there something like http://pinvoke.net/ for non-windows interop? I know that mono is wrapping things themselves, but on open wiki might help.


Many 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/) which can help you create a wrapper for C APIs, and the mono team have created [Cxxi](https://github.com/mono/cxxi), a binding generator for C++ APIs.


If Go already does C interop easily, what other factors make you want to consider using .NET instead?


Generics, iterators, functional-style programming, LINQ, asynchronous programming, dynamic, Reflection.Emit are the things that I would miss.


Existing API support, frameworks, libraries and IDE support.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: