Hello.
I need some tools to get property names of both Ruby objects and .Net
objects. First I thought that there'll be no problem with it. I tried to
do it like:
def GetPropertyList(obj)
return obj.instance_variables
end
But it turned out that when "obj" is a .Net object
obj.instance_variables
Orion Edwards wrote in post #1072378:
> I'm not sure exactly why this happens, I think it's something to do with
> how the .NET runtime itself delay-loads assemblies and the rules it has
> for looking for dependent dll's
> There are three ways I know of to work around this:
> 1. Use Dir.chdir to
Hello.
I've got 2 .Net assemblies, for example, Foo.dll and Boo.dll
Boo contains
namespace BooModule
{
public class Boo
{
public string Speak()
{
return "Hello from class Boo";
}
}
public interface IFoo
{
string Comment();
}
}
Foo contains
namespace FooModule
Did you added references to your project in VS2010?
Make references to IronRuby.dll, IronRuby.Libraries.dll,
Microsoft.Scripting.dll, and Micrsoft.Scripting.Core.dll
Although Microsoft.Dynamic.dll does not need referenced, it must be in
the directory of the executing assembly.
That's how it wor
Thanks for your answer, Eduardo.
I've done it as you adviced:
hashString = ModuleClass.GetObjectHash(testObject).to_s.to_clr_string
# in IronRuby code
and tried to call it in C#:
string netString;
engine.ExecuteFile(path).TryGetVariable("hashString", out netString);
Console.WriteLine(netString)
Re: [Ironruby-core] Calling .Net generic method with Ruby object
Orion Edwards
Wed, 18 Jul 2012 13:59:01 -0700
The .NET method can't accept normal IronRuby objects, because of the
new()
constraint.
IronRuby objects behind the scenes are all instances of A .NET class
called RubyObject - you can s
I'm using IronRuby 1.1.3 and .Net 4.
In IronRuby I've got two files:
1) Module.rb
# This file contains a class with static method GetObjectHash. The idea
is to parse the object find all it's properties and make a hash like:
{property_name => [property_type, property_value], ...}
2) Main.rb
# This
Hello. I've got this problem:
I'm having a .Net method with generics like this:
void Store(T obj) where T : class, new();
And I'm trying to call it from IronRuby project with Ruby object as an
argument.
comp = Computer.new
session.method(:Store).of(Computer).call(comp)
#session is another user