c# - Accessing .Net enums in Iron python -
i'm trying access .net(c#) enums in ironpython, lets have
test.dll
// contains several enums enum testtype{..} enum testquality{..} .... .... enum teststatus{..} //similarly multiple functions public void starttest(testtype testtype, testquality testquality){..} .... .... public teststatus getteststatus(){..}
and if try call above functions, need choose appropriate enum parameters , far did this,
iron python [vs2012]
import clr clr.addreference('test.dll') testdll import * test = test() # initiate enums enumtesttype = testtype enumtestquality = testquality .... .... enumteststatus = teststatus #call functions test.starttest(enumtesttype.basic, enumtestquality.high) .... .... # goes on
now above ironpython code works fine, odd bit here need initiate enums(intellisence doesnt work here) before use them functions, become more difficult when there more enums use. whereas in c# environment(vs2012) dont have initiate can use them straight away when calling functions.
is there better way of dealing in ironpython?
please correct me if i'm wrong, thanks!
assuming enums contained within test
class can either use them qualified
test.starttest(test.testtype.basic, test.testquality.high)
or importing
from testdll.test import testquality, testtype test.starttest(testtype.basic, testquality.high)
if enums in same namespace test
class should usable without additional imports:
test.starttest(testtype.basic, testquality.high)
Comments
Post a Comment