Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

10. The Class Library, Part 1 > Using Namespaces

Using Namespaces

image

There are two things you need to do in order to use the types declared in a given namespace. First, you have to tell the compiler about the namespace by setting a reference, and then you tell the code file about it with the using directive. (Technically, the using directive isn’t necessary, but as we’ll see, it saves a lot of typing.) To get our feet wet, let’s create a very cool version of “Hello, World!” using the System.Speech namespace.

0 Create a new WPF project and add a button to the window.

image

1 We’ll need a reference to the System.Speech namespace. You add references from the Add Reference dialog, available from the Project menu and the Reference node context menu in the Solution Explorer. Open it now, and display the .NET tab.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial