Write standards-compliant C# programs in Linux with DotGNU
Several books and tutorials on C# can be found on the Internet. The advantage of DotGNU is that it is completely standards compliant; therefore, you can use documentation from Microsoft's C# library. To get things done faster, you can use front ends, such as Microsoft's Visual Studio and Mono's MonoDevelop IDE . But if you want to write truly portable code with DotGNU, you'll have to be extra careful with these tools and make sure you stay away from features unique to a particular platform.
Languages and Libraries
C# borrows a bit from several popular languages, including C, C++, and Java. If you've programmed in Java, you'll find that, in C#, you can have a class name with a name that's not the same as the source file. Similar to Java, and unlike the C languages, C# doesn't have header files. Plus, you have the flexibility of either importing a namespace or specifying it fully when using a function like System.Console.Writeline. Again, this has the Java footprint all over it.
Also note that the C++ :: operator isn't required in C#. The task of referencing class members is accomplished with the dot (.) operator.
All the most important C# libraries are implemented in DotGNU. The library lineup includes the core System library that (among other things) contains classes for handling data types, the System.Collections library that helps define and traverse objects such as lists and arrays, System.IO for reading and writing streams and files, System.Net for network programming, System.Security for making your programs respect permissions, and, of course, System.Windows.Forms for creating GUIs.
However, some libraries are not directly available, such as System.Data, which provides classes to implement the ActiveX Data Object, or ADO for reading and writing data from various data stores such as databases. But you can use the ADO library via the ml-pnet package.
DotGNU-specific definitions for the packaged libraries are available online , although they are not complete, and it is possible that a function might not be defined there but available nonetheless. Some of the libraries do have missing constructs and methods, and you can also learn more about these elements online . However, this information might not be up to date.
- DotGNU website: http://www.gnu.org/software/dotgnu/
- Listings for this article: http://www.linux-magazine.com/resources/article_code
- MonoDevelop: http://monodevelop.com/
- DotGNU library definitions: http://www.gnu.org/software/dotgnu/pnetlib-doc/
- Library status: http://www.gnu.org/software/dotgnu/pnetlib-status/
Buy this article as PDF
New partnership will bring more and better CS training to US schools
Criminals offer online help over Tor network
Sophisticated malware is still present on Joomla and WordPress sites around the world.
Future versions of Ubuntu's code service will support the popular Git version control system used with Linux and other open source projects.
New release marks the arrival of AMD’s unified driver strategy.
A new study by IDC charts big changes in the big hardware market.
Azure CTO says Redmond has already considered the unthinkable.
Lead developer quells rumors that the Debian version is slated for center stage.
MSBuild is now just another GitHub project as Redmond continues its path to the light.
Malware could pass data and commands between disconnected computers without leaving a trace on the network.