Afternoon Luis
Just a question ..
why do you cast the value parameter in .SetSystemVariable to
objectie
AcadApp.SetSystemVariable("CMDECHO", (object)0);
I may be misunderstand the compiler process but I don't believe it is needed as I think the compiler looks after it
I know that the signature calls for an object, but ...
with this code c#
[CommandMethod("tset")]
public void testset ()
{
AcadApp.SetSystemVariable("CMDECHO", (object)0);
AcadApp.SetSystemVariable("CMDECHO", 1);
}
The generated dll through Reflection in c# is
[CommandMethod("tset")]
public void testset()
{
Application.SetSystemVariable("CMDECHO", 0);
Application.SetSystemVariable("CMDECHO", 1);
}
and reflection into CIL is
.method public hidebysig instance void testset() cil managed
{
.custom instance void [acmgd]Autodesk.AutoCAD.Runtime.CommandMethodAttribute::.ctor(string) = { string('tset') }
.maxstack 8
L_0000: nop
L_0001: ldstr "CMDECHO"
L_0006: ldc.i4.0
L_0007: box int32
L_000c: call void [acmgd]Autodesk.AutoCAD.ApplicationServices.Application::SetSystemVariable(string, object)
L_0011: nop
L_0012: ldstr "CMDECHO"
L_0017: ldc.i4.1
L_0018: box int32
L_001d: call void [acmgd]Autodesk.AutoCAD.ApplicationServices.Application::SetSystemVariable(string, object)
L_0022: nop
L_0023: ret
}
so by my reckoning both statements are equivalent.
[added]
Though I s'pose showing the casting is an indication of intent and a transparent convention that may be less confusing for casual viewers.
[added later]
but then again .. most of us should be familiar with seeing
(setvar "CMDECHO" 0)