ironruby

C# DynamicObject 动态对象

六月ゝ 毕业季﹏ 提交于 2020-05-06 06:50:02
dynamic是FrameWork4.0的新特性。dynamic的出现让C#具有了弱语言类型的特性。编译器在编译的时候不再对类型进行检查,编译期默认dynamic对象支持你想要的任何特性。比如,即使你对GetDynamicObject方法返回的对象一无所知,你也可以像如下那样进行代码的调用,编译器不会报错: dynamic dynamicObject = GetDynamicObject(); Console.WriteLine(dynamicObject.Name); Console.WriteLine(dynamicObject.SampleMethod()); dynamic与var关键字本质区别 var只能用作局部变量,不能用于字段,参数;声明的同时必须初始化;初始化时类型就已经确定了,并且不能再被赋值不能进行隐式类型转换的类型的数据。 var实际上是编译期抛给我们的“语法糖”,一旦被编译,编译期会自动匹配var 变量的实际类型,并用实际类型来替换该变量的申明,这看上去就好像我们在编码的时候是用实际类型进行申明的。 dynamic可用于类型的字段,方法参数,方法返回值,可用于泛型的类型参数等;可以赋值给或被赋值任何类型并且不需要显式的强制类型转换,因为这些是运行时执行的,这要得益于dynamic类型的动态特性。 dynamic被编译后,实际是一个object类型

Cucumber on IronRuby incredibly slow to start?

一笑奈何 提交于 2020-02-02 12:50:28
问题 I'm using IronRuby 0.9.1 and cucumber 0.4.0. I also have MRI 1.8 installed. I've created the following wrapper script (icucumber.bat) to run cucumber on IronRuby @ECHO OFF REM This is to tell IronRuby where to find gems. SET GEM_PATH=c:\ruby\lib\ruby\gems\1.8 @"C:\ironruby\bin\ir.exe" "c:\ruby\bin\cucumber" %* Navigating to cucumber-0.4.0\examples\i18n\en and running: cucumber features // takes about 4 seconds to complete icucumber features // takes about 30 seconds to complete Cucumber on IR

Cucumber on IronRuby incredibly slow to start?

不羁的心 提交于 2020-02-02 12:50:06
问题 I'm using IronRuby 0.9.1 and cucumber 0.4.0. I also have MRI 1.8 installed. I've created the following wrapper script (icucumber.bat) to run cucumber on IronRuby @ECHO OFF REM This is to tell IronRuby where to find gems. SET GEM_PATH=c:\ruby\lib\ruby\gems\1.8 @"C:\ironruby\bin\ir.exe" "c:\ruby\bin\cucumber" %* Navigating to cucumber-0.4.0\examples\i18n\en and running: cucumber features // takes about 4 seconds to complete icucumber features // takes about 30 seconds to complete Cucumber on IR

Assembly redirection in code instead of app.config

℡╲_俬逩灬. 提交于 2020-01-17 07:36:27
问题 I'm using ironruby to execute a script that loads an assembly with a dependency that needs to be redirected from v2.0.0.0 to v3.5.0.0 in the app.config like this: <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="3.5.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name=

IronRuby: Cannot call method on a COM Object with one or more arguments

雨燕双飞 提交于 2020-01-17 03:34:27
问题 When I try and call any method on a COM Object that takes one or more arguments, I get the following error on the last argument: Could not convert argument 0 for call to Open. (ArgumentError) Everything works fine when calling a method that takes no arguments, or getting/setting a property. Here is the code that gives me the error above: def new_com_object(prog_id) System::Activator.CreateInstance(System::Type.GetTypeFromProgID(prog_id)) end xls = new_com_object('Excel.Application') xls

Ironruby IDE

流过昼夜 提交于 2020-01-13 09:36:10
问题 Which IDE if any, are people using to develop Ironruby in? 回答1: Visual Studio? According to the IronRuby website Visual Studio C# Express can be used (and in turn, any commercial version of Visual Studio 2005+ I'll assume). From the IronyRuby.net home page: Today, you must check the source code out of the IronRuby Subversion repository on Rubyforge. You will need a Subversion client: we recommend TortoiseSVN. To build the sources from the command line, you must also have Ruby installed on

ASP.NET MVC 2 - Implementing custom Metadata and Validator Providers

好久不见. 提交于 2020-01-02 07:51:11
问题 With the preview 2 release of ASP.NET MVC 2, we now have base classes to implement our own custom providers for metadata and validation. Specifically, with ModelMetadataProvider and ModelValidatorProvider. There isn't a lot of documentation on these yet (just released yesterday as a preview , so I'm neither surprised nor disappointed). Has anyone gotten custom implementations of either of these working? A very simple example (metadata and validator for just "Required") would be great! Perhaps

Extending C# .NET application - build a custom scripting language or not?

梦想与她 提交于 2019-12-30 03:05:10
问题 I need to build a scripting interface for my C# program that does system level testing of embedded firmware. My application contains libraries to fully interact with the devices. There are separate libraries for initiating actions, getting output and tracking success/failure. My application also has a GUI for managing multiple devices and assigning many scripts to be run. For the testers (non-programmers, but technical), I need to provide a scripting interface that will allow them to come up

Downloaded IronRuby 1.1.3, but cannot find IronRuby.dll or IronRuby.Libraries.dll to reference

余生长醉 提交于 2019-12-25 02:16:25
问题 I am trying to reference IronRuby, IronRuby.Libraries, Microsoft.Scripting, Microsoft.Scripting.Core, and Microsoft.Scripting.ExtensionAttribute in a c# program using Visual Studio 2010. I read that you can find these .dll's under C:\Program Files\IronRuby 1.1\Lib\ironruby but there are no .dll files there. I've looked all over for these files but cannot find them. I've also searched and searched on the web for information on this and cannot find anything that helps. Any help will be greatly

IronRuby error: Microsoft.Scripting.Actions.Calls.OverloadInfo (trying to port MEF)

谁说胖子不能爱 提交于 2019-12-24 07:04:37
问题 I'm trying to upgrade some 4 year old code from a blog post that allows IronRuby to import/export MEF parts. The code is at: https://github.com/JogoShugh/IronRubyMef Unfortunately, I get this error when attempting to run: Method not found: 'Microsoft.Scripting.Actions.Calls.OverloadInfo[] Microsoft.Scripting.Actions.Calls.ReflectionOverloadInfo.CreateArray (System.Reflection.MemberInfo[]) I only found one reference to this on the IronRuby forum, and sent another note. But, does anyone else