I have a c# class “Document” with overloaded constructors (int id), (guid id) and some more parameter options – and no overload with 0 parameters. When I try to create a new object with IronRuby I stumble. It says it wants to have 0 arguments, so:
d = Document.new
works fine. But when I try
d = Document.new some_integer
I get the error message
"wrong number of arguments (1 for 0)"
The class def looks like this:
public Document(int id) : base(id)
{
// some code
}
Edit: here’s the complete code. It’s in an Umbraco context, and I translate namespaces with lower caseing to be able to use them in IronRuby:
$LOAD_PATH << "C:\\inetpub-dev\\dev.mysite.com\\bin"
require "cms.dll"
require "businesslogic.dll"
Web = Object.const_get("umbraco").const_get("cms").const_get("businesslogic").const_get("web")
existing_document_id = 1065
existing_document = Web::Document.new(existing_document_id)
Same code in C#:
var existingDocument = new umbraco.cms.businesslogic.web.Document(1065);
I wonder if you are hitting a namespace collision somewhere.
Is there any possibility that Document is defined somewhere else in what you are including?
We can’t see what your base class looks like
Also, we can’t see what requires/includes you are using
I set up an example, and it seems to work as expected:
Here is what the session looked like (using IronRuby 1.1.4.0):
Could you try with this simpler example code and see if you can create the objects in the way you are expecting?