Example: Hello World

As stated previously, the .NET Framework is both a specification and an implementation. Given that this book is intended for use by developers, it is about time that we demonstrated some of the framework's abilities. This simple example will highlight just how powerful and flexible the language integration between .NET languages is.

Listing 1.1 defines a Python class called HelloWorldPY.

Listing 1.1. Python class: HelloWorldPY
class HelloWorldPY:
    def __init__(self):
        self.message = "Hello World from Python!"
    def SayHello(self):
        _com_return_type_="System.Void"
        COR.System.Console.WriteLine(self.message)

if __name__=="__main__":
    AnObject = HelloWorldPY()
    AnObject.SayHello()

The class HelloWorldPY defines two methods, a constructor ...

Get Programming in the .NET Environment now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.