2014-07-24 1 views
1

최근 IronPthon을 내 C# 프로젝트의 스크립트 엔진으로 사용하여 책에서 설명한 "IronPython in Action"과 같은 추가 기능을 개발합니다. 하지만 ref_param을 사용하여 C# 함수를 호출하면이를 처리하는 방법을 알지 못합니다! 이 같은 C# 코드 : 울부 짖는 소리로ironpython에서 C# 함수를 호출 할 때 ref 매개 변수를 처리하는 방법

public class TestCSharp 
{ 
    public void run(ref byte stop) 
    { 
     while(!stop) 
     { 
      // do something 
     } 
    } 
} 

IronPython의 코드 :

inst = TestCSharp() 
stop = System.Byte(0) 
t = Thread(...) 
// call inst.run() in thread t 
inst.run(stop) 
// do something 
stop = System.byte(1) 

하지만 inst.run는

아무도 이유를 알고 멈출 수 없다? 내 접근 방식이 옳지 않다면 어떻게 요구 사항을 이행 할 수 있습니까? 대단히 감사합니다!

답변

0

그들은 returned as a result tuple 위치 :

>>> d = { "a":100.1, "b":200.2, "c":300.3 } 
>>> from System.Collections.Generic import Dictionary 
>>> d = Dictionary[str, float](d) 
>>> d.TryGetValue("b") 
(True, 200.2) 
>>> d.TryGetValue("z") 
(False, 0.0) 
관련 문제