我有兩個文件,一個普通的Python(.py)文件和一個Visual Studio C#文件(.cs)。我想在python文件中使用返回一個字符串並在C#文件中使用該字符串的函數。C# - 從Python文件使用方法
基本上是:
#This is the Python file!
def pythonString():
return "Some String"
和
//This is the C# file!
namespace VideoLearning
{
string whatever = pythonString(); // This is from the Python file.
}
我如何排序的這兩個文件鏈接在一起?謝謝。
這並不容易。您可以使用IronPython創建.NEt兼容對象,然後您可以從C#項目中使用該對象:http://ironpython.net/documentation/dotnet/dotnet.html#declaring-net-types – jessehouwing