Q:

Trying to understand a particular part of code from microsoft tutorials regarding Word Add-Ins

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
    this.Application.DocumentOpen +=
           new Word.ApplicationEvents4_DocumentOpenEventHandler(WorkWithDocument);

    ((Word.ApplicationEvents4_Event)this.Application).NewDocument +=
            new > Word.ApplicationEvents4_NewDocumentEventHandler(WorkWithDocument);  
}

private void WorkWithDocument(Microsoft.Office.Interop.Word.Document Doc)
{
    try
    {
            Word.Range rng = Doc.Range(0, 0);
            rng.Text = "New Text";
            rng.Select();
    }
    catch (Exception ex)
    {
            // Handle exception if for some reason the document is not available.
    }
}

This is the full code. From what I understand it's supposed to initiate the Add-In, check if the document is avaliable. The part I have trouble understanding is this:
((Word.ApplicationEvents4_Event)this.Application).NewDocument ...

What I don't understand is the (Word.ApplicationEvents4_Event) right before this.Application. Is that some kind of an event-like typecast? I've got no idea. 

A:

The documentation states that it is an interface, so the code is casting this.Application to that interface.
Documentation for Application explains this:

This is a .NET interface derived from a COM coclass that is required
  by managed code for interoperability with the corresponding COM
  object. Use this derived interface to access all method, property, and
  event members of the COM object. However, if a method or event you
want to use shares the same name under the same COM object, cast to
the corresponding primary interface to call the method, and cast to
the latest events interface to connect to the event. Refer to this
  topic for information about the COM object. For information about the
  method and property members of the COM object, see _Application. For
  information about the event members of the COM object, see
  ApplicationEvents4_Event.

