Ivan,

In this case you actually can't do foo = x::y::z::Foo.new(1) because
IronRuby doesn't support lowercase namespace.  It think it's a method call.

That's why I started out
Foo = Type.get_type("x.y.z.Foo, MyAssembly, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null", true).to_class

Aaron

On Mon, Dec 8, 2008 at 4:52 PM, Ivan Porto Carrero <[EMAIL PROTECTED]>wrote:

> Normally
> foo = x::y::z::Foo.new(1)
>
> in the console you need to use global variables:$foo = x::y::z::Foo.new(1)
>
>
>
> On Mon, Dec 8, 2008 at 10:43 PM, Aaron Feng <[EMAIL PROTECTED]> wrote:
>
>> I tried to load the struct the same way, but I don't know how to set the
>> value of it.  For example:
>>
>> C#
>>
>> namespace x.y.z {
>>     public struct Foo {
>>         public long Bar;
>>         public Foo(long bar) {
>>             this.Bar = bar;
>>         }
>>     }
>> }
>>
>> var foo = new x.y.z.Foo(1);
>>
>> IronRuby
>>
>> Foo = Type.get_type("x.y.z.Foo, MyAssembly, Version=1.0.0.0,
>> Culture=neutral, PublicKeyToken=null", true).to_class
>>
>> # how do I do the equivalent of
>> # var foo = new x.y.z.Foo(1); ?
>>
>> Aaron
>>
>>
>> On Mon, Dec 8, 2008 at 3:45 PM, Tomas Matousek <
>> [EMAIL PROTECTED]> wrote:
>>
>>>  You can use Assembly.LoadFile and point it to an absolute path instead.
>>>
>>>
>>>
>>> Tomas
>>>
>>>
>>>
>>> *From:* [EMAIL PROTECTED] [mailto:
>>> [EMAIL PROTECTED] *On Behalf Of *Aaron Feng
>>> *Sent:* Monday, December 08, 2008 12:33 PM
>>>
>>> *To:* [email protected]
>>> *Subject:* Re: [Ironruby-core] Handling C# lower case namespaces
>>>
>>>
>>>
>>> Ok,  I got Assembly.Load and Type.get_type both to work with my own
>>> DLL.  The actual DLL have to live where ir.exe lives.  Is there a way for it
>>> to look in the directory of the ruby file?  Like the way require statement
>>> work.
>>>
>>> Aaron
>>>
>>>
>>>  On Mon, Dec 8, 2008 at 2:11 PM, Tomas Matousek <
>>> [EMAIL PROTECTED]> wrote:
>>>
>>> Can you load the assembly and get the type explicitly?
>>>
>>>
>>>
>>> require 'mscorlib'
>>>
>>> System::Reflection::Assembly.Load("IronNails.Library, Version=1.0.0.0,
>>> Culture=neutral, PublicKeyToken=null").GetType(
>>> 'IronNails.View.XamlProxy')
>>>
>>>
>>>
>>> Tomas
>>>
>>>
>>>
>>> *From:* [EMAIL PROTECTED] [mailto:
>>> [EMAIL PROTECTED] *On Behalf Of *Ivan Porto Carrero
>>> *Sent:* Monday, December 08, 2008 9:46 AM
>>>
>>>
>>> *To:* [email protected]
>>>
>>> *Subject:* Re: [Ironruby-core] Handling C# lower case namespaces
>>>
>>>
>>>
>>> I get the same behavior.
>>> I can load types from the CLR but not from my own assembly.
>>>
>>> I copied my assembly into the folder that contains ir.exe
>>>
>>> >>> require 'mscorlib'
>>> => true
>>> >>> require 'IronNails.Library, Version=1.0.0.0, Culture=neutral,
>>> PublicKeyToken=null'
>>> => true
>>> >>> IronNails::View::XamlProxy
>>> => IronNails::View::XamlProxy
>>> >>> System::Type.get_type 'IronNails.View.XamlProxy'
>>> => nil
>>> >>> System::Type.get_type 'System.String'
>>> => #<System::RuntimeType:0x000005c>
>>> >>> IronNails::View::XamlProxy.to_clr_type
>>> => #<System::RuntimeType:0x000005e>
>>>
>>>
>>>  On Mon, Dec 8, 2008 at 5:54 PM, Aaron Feng <[EMAIL PROTECTED]>
>>> wrote:
>>>
>>> Tomas,
>>>
>>> I tried it again.  I couldn't get the following to work with my own DLL
>>> even If I capitalize the namespace (It does work fine with build in types
>>> like System.String):
>>>
>>> > System::Type.get_type("Abc.Hi, Version=1.0.0.0, Culture=neutral,
>>> PublicKeyToken=null")
>>>
>>> Do I have any other options?
>>>
>>> Thanks,
>>>
>>>
>>> Aaron
>>>
>>> _______________________________________________
>>> Ironruby-core mailing list
>>> [email protected]
>>> http://rubyforge.org/mailman/listinfo/ironruby-core
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Ironruby-core mailing list
>>> [email protected]
>>> http://rubyforge.org/mailman/listinfo/ironruby-core
>>>
>>>
>>>
>>> _______________________________________________
>>> Ironruby-core mailing list
>>> [email protected]
>>> http://rubyforge.org/mailman/listinfo/ironruby-core
>>>
>>>
>>
>> _______________________________________________
>> Ironruby-core mailing list
>> [email protected]
>> http://rubyforge.org/mailman/listinfo/ironruby-core
>>
>>
>
> _______________________________________________
> Ironruby-core mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to