Skip to Content
Introducing .NET 4.0: with Visual Studio 2010
book

Introducing .NET 4.0: with Visual Studio 2010

by Alex Mackey
February 2010
Beginner content levelBeginner
400 pages
11h 13m
English
Apress
Content preview from Introducing .NET 4.0: with Visual Studio 2010

3.4. Improved COM Interoperability

Many of the language enhancements we have looked at so far can greatly ease working with legacy code such as COM objects.

Let's look in more detail by adapting an example from Scott Hansleman's blog (www.hanselman.com/blog/CLRAndDLRAndBCLOhMyWhirlwindTourAroundNET4AndVisualStudio2010Beta1.aspx).

In Scott's example, the Microsoft Office API is used to open an existing text file. To see this example, add the following code and a reference to Microsoft.Office.Interop.Word, and then take a look at the IntelliSense for the Open() method (see Figure 3-1):

using Microsoft.Office.Interop.Word; var WordApplication = new Microsoft.Office.Interop.Word.Application(); WordApplication.Visible = true; object missing = System.Reflection.Missing.Value; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

ASP.NET 3.5 For Dummies®

ASP.NET 3.5 For Dummies®

Ken Cox
ASP.NET 4 Unleashed

ASP.NET 4 Unleashed

Stephen Walther, Kevin Hoffman, Nate Dudek

Publisher Resources

ISBN: 9781430224556Purchase book