Appendix A. A whirlwind tour of C#
Obviously this book has primarily been about IronPython, but in several places we’ve explored some aspects of using IronPython with other .NET languages, the foremost being C#. If you don’t know C#, this appendix will give you a brief overview of the core parts of the language. It should be enough to let you read the code examples in the book, although you’ll probably want more detail if you’re trying to write C# code.
Namespaces are similar to Python packages and modules. The classes in an assembly live in namespaces, which can be nested to provide a hierarchical structure. This structure is used to group together related classes to make them easier to find. Namespaces are specified in C# like so:
Here we declare a namespace called EvilGenius.Minions, which contains the GiantRobot class. Another major feature of namespaces is that they enable us to avoid name collisions: the fully qualified name of the class is EvilGenius.Minions.GiantRobot, and we could happily use other GiantRobot classes in our project as long as they are in different namespaces.