I'm playing with the difference between C # and IronRuby. I have noticed that if I define a property by using attr_accessor in Ruby, then it is presented as property to C # If I, on the other hand, I make the code, it comes back as a method. For example, take this code:
var engine = Ironbury .ububy.CreateEngine (); String script = @ "Class test atre_assoresource: automatic deef manual @ manual and deaf manual = (val) @ manual = val and def initialization @automatic =" "test" "manual =" "testing" "end and test.New" ; Var testObject = engine.Execute (script); Var automatic = testObject.automatic; Var manual = testObject.manual; When you see the C # automated variable, the value is a string of "test" if you use the C # manual variable If you see, this type is IronRuby.Builtins.RubyMethod.
Finally, I want to create my own property in Ruby which can be used in C #, but I think they do not see properties like attr_accessor Can.
I think there is some magic in the module code of Ruby source code (ModuleOps.cs: DefineAccessor). Is there any way to do this in Ruby Code directly?
This special issue was discussed further in IronRuby - Core thread:
< / Div>
Comments
Post a Comment