# Another Interop Question

**URL:** <https://www.ruby-forum.com/t/another-interop-question/152129>\
**Category:** IronRuby\
**Created:** [October 30, 2008, 12:26pm UTC](https://www.ruby-forum.com/t/another-interop-question/152129 "2008-10-30T12:26:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![diabolist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c2a13f/32.png) [@diabolist](https://www.ruby-forum.com/u/diabolist)\
**Post date:** [October 30, 2008, 12:26pm UTC](https://www.ruby-forum.com/t/another-interop-question/152129/1 "2008-10-30T12:26:30Z")

</div>

> From C#, is it possible to new up an instance of an IronRuby class and  
> then invoke a method on it?

I.e:

var ruby = new StringBuilder();

ruby.AppendLine(“class MyClass”);  
ruby.AppendLine(" def render");  
ruby.AppendLine(" “Hello!”");  
ruby.AppendLine(" end");  
ruby.AppendLine(“end”);

var scriptEngine = Ruby.CreateEngine();

scriptEngine.Execute(ruby.ToString());

var action =  
scriptEngine.CreateScriptSourceFromString(“MyClass.method(:new)”).Execute();

var o = scriptEngine.Operations.Call(action);

// how to invoke render?

Cheers,

Andrew.

---

<div class="post-metadata">

**Author:** ![diabolist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c2a13f/32.png) [@diabolist](https://www.ruby-forum.com/u/diabolist)\
**Post date:** [October 31, 2008, 2:40am UTC](https://www.ruby-forum.com/t/another-interop-question/152129/2 "2008-10-31T02:40:45Z")

</div>

No worries, I’ve found what I need in Phil H.'s IronRuby view engine  
sample.

Cheers,

Andrew.

---

<div class="post-metadata">

**Author:** ![diabolist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c2a13f/32.png) [@diabolist](https://www.ruby-forum.com/u/diabolist)\
**Post date:** [October 31, 2008, 3:19am UTC](https://www.ruby-forum.com/t/another-interop-question/152129/3 "2008-10-31T03:19:24Z")

</div>

Cool. Now you can provide an answer when the next person asks. 🙂
