When looking for information in the api help, everyone may have some questions. An object may have different names and the same function descriptions. One with the letter "I" and one without.
As shown in the figure below, the most commonly used ActiveDoc
in our previous code actually mentioned this in the front of the api help, but most people will not start from the beginning.
And examples of differences in language grammar:
Back to the topic:
Those with I belong to the interface, and the type of the specified object is returned, which cannot be accessed directly.
Looking at these two figures, the most obvious thing is that there is no small lightning event access in the object with i.
If the event processing is not involved in the development, try to use interface objects with I as much as possible, so there is no need to perform type conversion.
As we often wrote before:
Get the current document
ModelDoc2 swModel = (ModelDoc2)swApp.ActiveDoc;
Can be written as
ModelDoc2 swModel = swApp.IActiveDoc2;
Of course, the simplest is definitely to use var directly in front of it:
var swModel = swApp.IActiveDoc2;
From the first content of the api help, you will find that many knowledge points are explained. I hope to be helpful.