asri.chejarla

Casting Interfaces

Discussion created by asri.chejarla on Nov 12, 2010
Latest reply on Nov 28, 2010 by asri.chejarla
I am very new to ArcObjects using .NET (C#) and trying to learn of my own.I have a doubt, may be a very basic one but am lost...

private IApplication = m_application;
IMxDocument doc = m_application.Document as IMxDocument;
In the above code my understanding is ...
1. m_aplication is a Iapplication variable.
2. Document is a property of IApplication that holds the arcmap document.
3. Since IMxDocument provides access to the Document (m_application.Document), it is casted to IMxDocument and stored in IMxDocument type variable doc.

If I am correct on this, then why is doc not casted to IActiveView before assigning it to IActiveView type variable in the below code...
IActiveView vw = doc.ActiveView;
If I am wrong on my understanding as described above, then please correct me. I am totally confused and lost. I would be very thankful to all your precious time and support.

Outcomes