What's Difference between ApplicationServices & ApplicationServices.Core

What's Difference between ApplicationServices & ApplicationServices.Core

Amremad
Collaborator Collaborator
2,521 Views
4 Replies
Message 1 of 5

What's Difference between ApplicationServices & ApplicationServices.Core

Amremad
Collaborator
Collaborator

Hi All 

 

What's Difference between :

1. Autodesk.AutoCAD.ApplicationServices

2. Autodesk.AutoCAD.ApplicationServices.Core 

 

i think they have the same method ?

0 Likes
Accepted solutions (2)
2,522 Views
4 Replies
Replies (4)
Message 2 of 5

norman.yuan
Mentor
Mentor

They are "namespace", not class (thus, do not have "method").

 

"namespace" is for organising classes. It is a bit similar to File Path with File Name: you may have 2 files with the same file name, but the contents could be different. You cannot place the 2 files in the same folder (path), instead, you place them in different folders, and refer to them with different full path/file name, when you somehow need to deal with both at the same time.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 5

Amremad
Collaborator
Collaborator

sorry i missed . yes they are namespaces 

 

but my question is :

 

what's the different  between the next two line 

 

Document document1 =  Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument;
Document document2 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;

both two give me the Active Document

0 Likes
Message 4 of 5

norman.yuan
Mentor
Mentor
Accepted solution

Well, Autodesk.AutoCAD.Application.ApplicationServices.Application inherits Autodesk.AutoCAD.ApplicationServices.Core.Application.

 

Since ...ApplicationServices.Core.Application has the property "DocumentManager", thus ...ApplicationServices.Application automatically has the same property. Therefore,

 

...ApplicationServices.Core.Application.DocumentManager and ApplicationServices.Application.DocumentManager point to the same DocumentCollection object.

Norman Yuan

Drive CAD With Code

EESignature

Message 5 of 5

_gile
Consultant
Consultant
Accepted solution

Hi

 

The Autodesk.AutoCAD.ApplicationServices.Application class is derived from Autodesk.AutoCAD.ApplicationServices.Core.Application one.

 

You can see this in Visual Studio:

 

VS_metedata.png

 

or in ILSpy:

 

ILSpy.png

 

Norman was faster...



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub