2

I've been told/rebutted/asked by so many colleagues and strangers, who have emphatically asserted to me, that C# is a strictly Windows platform language.

I'd love to hear from those who have been working on C# projects in a non-Windows platform, and also hear about what tech stack they are using, in order to do this.

ElektroStudios
  • 19,105
  • 33
  • 200
  • 417
code4life
  • 15,655
  • 7
  • 50
  • 82
  • Actually you can use C# in [.NET Core](https://learn.microsoft.com/en-us/aspnet/core/tutorials/your-first-mac-aspnet) completely cross platform now. – kman Apr 05 '17 at 04:33
  • This feels more like a forum chat post rather than a question. The title question is one thing, and can easily be answered by a simple web search. The question itself is an invitation to a discussion, which doesn't work at Stack Overflow. – Sami Kuhmonen Apr 05 '17 at 04:52
  • C# gets used a lot cross platform.... also in the F# world, it almost seems like that everyones using non windows machines. – Keith Nicholas Apr 05 '17 at 05:34
  • also, I use Jetbrains rider ide on my Mac for C# – Keith Nicholas Apr 05 '17 at 05:34
  • https://www.jetbrains.com/rider/ – Keith Nicholas Apr 05 '17 at 05:36

1 Answers1

6
  1. "Visual Studio Code" a cross-platform editor and lightweight IDE with C# support
  2. Xamarin - C# for Linux (Mono) and Android
  3. "Visual Studio for Mac" - https://www.visualstudio.com/vs/visual-studio-mac/ - C# for macOS and iOS
  4. Cross-platform .NET Core (DNX) - https://www.microsoft.com/net/core

C# itself is a language that is, in fact, platform agnostic. The .NET Framework's Base Class Library was originally rather Windows-centric until recently (though there were open-source cross-platforms in dotGnu and Mono).

The main Windows-only things in .NET today are:

  • System.Windows.Forms: WinForms - a wrapper around Win32 and hWnd)
  • System.Drawing.* (a wrapper around GDI)
  • WPF: There is next-to-nothing about WPF that inherently ties it to Windows, however there has been no serious attempt to port it to other platforms. The closest is Moonlight, which is Mono's version of Silverlight, however it is not a drop-in replacement for WPF.
  • and of course, the Microsoft.Win32 namespaces.

There are other things, like System.Diagnostics.Process which are clearly designed around the presumption of a Windows environment (e.g. Process.Handle).

Another problem to contend with is bad assumptions in third-party libraries, such as code always using \r\n for line-breaks instead of Environment.Newline, or code assuming the use of driver-letters and backslashes in paths.

Dai
  • 141,631
  • 28
  • 261
  • 374