2012-01-05 10 views
0

私はIronPythonを初めて使いましたが、何年もPythonを使用してきました。私はいくつかのC#アプリケーションを継承し、Pythonを介していくつかのクラスにアクセスしたいと思います。私はPythonでインポートするとIronPython静的プログラムクラス可視性

namespace Updater { 
    static class Program { 
     /// <summary> 
     /// The main entry point for the application. 
     /// </summary> 
     [STAThread] 
     static void Main() { 
      //Application.EnableVisualStyles(); 
      Application.SetCompatibleTextRenderingDefault(false); 
      Application.Run(new Form1()); 
     } 
    } 
} 

::次のC#を考えると

>>> clr.AddReferenceToFile('Updater.exe') 
>>> import Updater 
>>> dir(Updater) 
['Form1'] 

はなぜ見えプログラムではありませんか?

答えて

2

C#のクラスに対するデフォルトの可視性はinternalです。したがって、IronPythonはProgramクラスを表示しません。詳細はhttps://stackoverflow.com/a/3763638/129592を参照してください。

あなたは

public static class Program { 
    // etc. 
} 
にクラス宣言を変更することによって、それを修正することができます