例えば:
ruby コード (テスト用):
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.
OK、関連する質問で IronRuby 文字列メソッド to_clr_string を見つけたので、質問は、他のタイプの同じメソッドに関するドキュメントをどこで見つけることができるかということです?