On Tue, Apr 26, 2011 at 1:06 AM, sridharans sivamurugan
<li...@ruby-forum.com> wrote:
> Tomas Matousek wrote in post #995011:
>> Would this be what you need?
>> http://ironruby.codeplex.com/workitem/4920
>>
>> Tomas
>
> Hi Tomas,
>
> Yes exactly the same. I need to get those methods as property in C#. Do
> you have any idea to achieve this?
>
> Thanks,
> Sri.

Sri, do you actually need to use .NET Reflection APIs? If so, then
your Ruby class would have to inherit from an interface where the
properties you'd want to reflect over are defined. However, I highly
doubt that you absolutely need to use .NET's reflection; you just want
to find the method names available on a Ruby object, correct? Ruby
itself has it's own reflection capabilities built into the language
(Persion.instance_methods), and the DLR hosting API lets you use C# to
access Ruby-defined entities; take a look at the methods on
ScriptEngine.Operations to see what you need to do from C#;
GetMemberNames might be useful to you. You could also write the
reflection code in Ruby and pass the result back to C#:

var personMethods = engine.Execute("Person.instance_methods -
Object.instance_methods", someScope);


~Jimmy
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to