铁蟒如何在C#类中扮演(mean或nice)角色?
我对用IronPython在我的C#程序中编写一些例程感兴趣。我关心的是整合。我有一个简单的课程:铁蟒如何在C#类中扮演(mean或nice)角色?,c#,integration,ironpython,C#,Integration,Ironpython,我对用IronPython在我的C#程序中编写一些例程感兴趣。我关心的是整合。我有一个简单的课程: public class candleStim { public virtual int Id { get; set; } public virtual int candleNumber { get; set; } public virtual DateTime date { get; set;
public class candleStim
{
public virtual int Id { get; set; }
public virtual int candleNumber { get; set; }
public virtual DateTime date { get; set; }
public virtual decimal open { get; set; }
public virtual decimal high { get; set; }
public virtual decimal low { get; set; }
public virtual decimal close { get; set; }
public virtual List<EMA> EMAs { get; set; }
public virtual List<SMA> SMAs { get; set; }
public virtual string simulationID { get; set; }
}
公共类烛台
{
公共虚拟整数Id{get;set;}
公共虚拟整数candleNumber{get;set;}
公共虚拟日期时间日期{get;set;}
公共虚拟十进制打开{get;set;}
公共虚拟小数高位{get;set;}
公共虚拟十进制低位{get;set;}
公共虚拟小数关闭{get;set;}
公共虚拟列表EMAs{get;set;}
公共虚拟列表SMAs{get;set;}
公共虚拟字符串模拟ID{get;set;}
}
用IronPython编写的方法能理解这个类吗?一个简单的字符串对象呢,它们在C#和IronPython中是一样的吗?如果没有,我将如何进行转换?谢谢大家! 你可以自己轻松地检查这些工作有多好 我不知道你在用什么工具,但如果你和我一起,你可以做很多实验 下面的示例只是一些自动生成的IronPython Winforms项目代码,其中引用了您的类,该类构建为标准类库C#project。(不过,您必须将生成的程序集复制到IronPython项目目录中) 我唯一不确定的是EMA/SMA——如果您希望这些是从一些库中导入的一些“标准”Python类,或者只是您的一些自定义类
“相同与否”是什么意思?IronPython是在.NET上构建的(并且使用了它的类)!它们确实是我的自定义类,它们甚至在put/get类变量上有一些逻辑。我想知道这将如何整合。感谢我提供的链接,如果这些是您自己的自定义类,那么它们一定没有问题。
import clr
clr.AddReference('System.Drawing')
clr.AddReference('System.Windows.Forms')
### importing our assembly
clr.AddReference('ClassLibrary1ForPython')
from System.Drawing import *
from System.Windows.Forms import *
from ClassLibrary1ForPython import *
class MyForm(Form):
def __init__(self):
# Create child controls and initialize form
pass
### your class instantiating
classInstance = candleStim()
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
form = MyForm()
### setting the window title from the value of a property of your class (standard string)
form.Text = classInstance.simulationID
Application.Run(form)