I guess you can do that in two ways.

The first one is to add a statement in Ruby code:

class Object
  def mymethod(str)
    MyCSharpClass.mymethod(str)
  end
end

Or you can write an IronRuby extension in C# and make that class extend the
Object class.

Shay.

-- 
--------------------------------------------------
Shay Friedman
Author of IronRuby Unleashed
http://www.IronShay.com
Follow me: http://twitter.com/ironshay

On Fri, Nov 13, 2009 at 8:22 PM, Alexandre Mutel <li...@ruby-forum.com>wrote:

> Hi all,
> Is there any way to declare a C# static method accessible from IronRuby
> as a regular Ruby method?
> like:
> public class MyCSharpClass {
>  public static string mymethod(string test) {
>     return test + "yes";
>  }
> }
>
> in ironruby:
> puts mymethod("test")
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core@rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to