What is a current analog of COM technology?
COM technology seems a little outdated already, though still in use. But what approach is recommended now for implementing the same kind of interop开发者_运维问答erability when building a .NET app, specifically, in WPF?
I.e. what is a modern replacement of a COM object?
.NET was very much intended to be the replacement for COM. The project had many names while it was being worked on, but it started life as "COM+". This influence is still evident in many places. Many of the core source code files for the CLR start with the name "com", even though the CLR uses (almost) no COM at all. The Windows exception code for a managed exception is 0xE0434F4D. The last 3 byte values of the code is ASCII for "COM".
The assertion that WCF was a replacement is not accurate. It replaced .NET Remoting. COM has a very wide range, it is a generic interop tool, much like the CLR allows many languages to interoperate. One of its features was supporting interop between different processes and machines, perhaps the source of the statement. But that's just a part of it.
There are still lots of COM applications that have not been replaced by .NET. The best example is the Windows shell, Explorer.exe. Pretty hard to do something as simple as creating a context menu shell extension in C#. And until .NET 4.0 strongly discouraged.
In a general sense, .NET itself is the replacement for COM, and the replacement for a COM object is a .NET assembly. See for example the highly suggestive chapter title of this early .NET book by Don Box and Chris Sells (who one can be pretty sure know what they're talking about...)
What approach is recommended now for implementing the same kind of interoperability when building a .NET app, specifically, in WPF?
It's called WCF
WCF is designed in accordance with service oriented architecture principles to support distributed computing where services are consumed by consumers.
Take a look at the first paragraph in this wikipedia article.
WCF is the modern-day replacement for COM.
精彩评论