EDN Admin
Well-known member
I feel silly and am wondering if Im having a lapse with the mind or something, but I program with a 3rd party api. They also have a com api for other features. In this particular situation, the property is part of an object in the .net api whose
value is an enum from the com api. Supposedly, I can use the numerical enumeration value to assign to the property and avoid referencing the com api. Unfortunately, the only example given was in VB.NET. How do you do this in C#?
VB.NET Code:
<pre class="prettyprint lang-vb late binding (without Reference to acad interops)
Dim acadApp As Object = Application.AcadApplication
36 is the enum value of ac2007_dwg
acadApp.Preferences.OpenSave.SaveAsType = 36[/code]
Typically in C# I would do the following if using the numerical assignment:
<pre class="prettyprint AcadApplication acadApp = (AcadApplication)Application.AcadApplication;
//set the 2007 DWG as default
acadApp.Preferences.OpenSave.SaveAsType = (AcSaveAsType)36;[/code]
The problem of course is that the type AcSaveAsType is defined in the com api. So how can I do the same as in the VB code without requiring the defining type?<br/><hr class="sig Jason
View the full article
value is an enum from the com api. Supposedly, I can use the numerical enumeration value to assign to the property and avoid referencing the com api. Unfortunately, the only example given was in VB.NET. How do you do this in C#?
VB.NET Code:
<pre class="prettyprint lang-vb late binding (without Reference to acad interops)
Dim acadApp As Object = Application.AcadApplication
36 is the enum value of ac2007_dwg
acadApp.Preferences.OpenSave.SaveAsType = 36[/code]
Typically in C# I would do the following if using the numerical assignment:
<pre class="prettyprint AcadApplication acadApp = (AcadApplication)Application.AcadApplication;
//set the 2007 DWG as default
acadApp.Preferences.OpenSave.SaveAsType = (AcSaveAsType)36;[/code]
The problem of course is that the type AcSaveAsType is defined in the com api. So how can I do the same as in the VB code without requiring the defining type?<br/><hr class="sig Jason
View the full article