例如:
红宝石代码(仅用于测试):
def process_initial_array (ar)
ar.join(" ")
end
c# 代码:在这里我创建字符串列表并将其传递给 IronRuby
List<string> source_values = new List<string>();
它充满;
label2.Text=IronRuby.CSharp.BasicInteraction.calculator(source_values);
namespace IronRuby.CSharp
{
public class BasicInteraction
{internal static string calculator(List<string> source_values)
{
var rubyEngine = Ruby.CreateEngine();
var scope = rubyEngine.ExecuteFile("math_logic.rb");
string result = rubyEngine.Operations.InvokeMember(scope, "process_initial_array", source_values);
return result;
}
}
}
它唤起:
An unhandled exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Anonymously Hosted DynamicMethods Assembly
Additional information: Unable to convert implicitly "IronRuby.Builtins.MutableString" to "string". There is explicit conversion.
好的,我在相关问题中找到了 IronRuby 字符串方法 to_clr_string,所以问题是我在哪里可以找到关于其他类型的相同方法的文档?