ironruby

Integration of C#, F#, IronPython and IronRuby

半城伤御伤魂 提交于 2019-12-06 02:43:56
问题 I was told that the assembly files made from C# and F# source is interoperable as they are compiled into .NET assembly. Q1 : Does that mean that C# can call F# functions just like they are C# functions? Q2 : How about the IronPython and IronRuby? I don't see any assembly dll from the IronPython/IronRuby. Q3 : Is there any easy way to use IronPython/IronRuby functions from C# or F#? Any example code would be great. 回答1: 1) Yes. Using a simple example, in F#, I can invoke the main method of a C

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

自作多情 提交于 2019-12-06 00:27:34
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 a lot of people have the same idea, but I'd like to use IronRuby to inject the metadata, and I'm

How to use an IronRuby block with a C# method

白昼怎懂夜的黑 提交于 2019-12-05 14:01:27
I'm using IronRuby and trying to work out how to use a block with a C# method. This is the basic Ruby code I'm attempting to emulate: def BlockTest () result = yield("hello") puts result end BlockTest { |x| x + " world" } My attempt to do the same thing with C# and IronRuby is: string scriptText = "csharp.BlockTest { |arg| arg + 'world'}\n"; ScriptEngine scriptEngine = Ruby.CreateEngine(); ScriptScope scriptScope = scriptEngine.CreateScope(); scriptScope.SetVariable("csharp", new BlockTestClass()); scriptEngine.Execute(scriptText, scriptScope); The BlockTestClass is: public class

Can I compile IronRuby project in VS2010 into DLL/exe file?

我与影子孤独终老i 提交于 2019-12-05 11:51:05
After created IronRuby project in VS2010 by using IronRuby v1.1.x, I was able to use almost .NET library by importing them. But can't actually compile ironruby into exe/DLL. I see the build option but can't build any exe or DLL from IronRuby project. Please help ! Steve You can't compile your IronRuby classes into a .NET assembly and then access them from another assembly. Preet is right that the nearest you can get is to embed your IronRuby scripts in (say) a C# assembly. From the C# side it would then be possible to instantiate your Ruby classes. So given the following Ruby class: class

is F# to IronPython/IronRuby as C# is to VB.NET?

假装没事ソ 提交于 2019-12-05 05:45:43
I just listened to podcast of Chris Smith talking about F# in which he talks about how F# is a language which allows you to approach problems in a different way than in C#/VB.NET, i.e. instead of "pushing bits around" you "chain together data transformations", and that how F# will "become like XML", something that you use in addition to your language of choice (C# or VB.NET) in order to solve certain problems in a more efficient way. This got me to thinking about the relationship of the .NET languages, here's how I understand them: C# and VB.NET are syntactically but not substantially

Short namespace acronym in ruby

泪湿孤枕 提交于 2019-12-05 02:26:55
I'm very new to ruby. I use IronRuby and my ruby code has long namespaces: Company:: Division::Group::Product::Package.new since I use this ns multiple times is there a way to create a shortcut? In c# I add a using clause so I'm not required to specify the full prefix. You can simply assign it to another constant, like: Package = Company::Division::Group::Product::Package Package.new You can also use the "include" method, which is more Ruby-esk: include Company::Division::Group::Product Package.new The difference between this and the current answer is that this one pulls in all constants under

IronRuby On Rails VS. Ruby On Rails (Getting Started)

感情迁移 提交于 2019-12-04 19:34:59
问题 The Scenario I am a C#/ASP.NET/MVC/Silverlight developer with a few years experience. I'm trying to kickstart my Ruby On Rails learning. I'm currently trying to get a real feel for ROR. I Want To Know Standards As a .Net developer, you tend to use a standard IDE (Visual Studio), a few standard databases (SQL Server, Oracle etc.), and a particular way in which to style your web 2.0 application (XHTML/CSS, Silverlight etc.) 'So what are the standard equivalents to these in RUBY ON RAILS!? (IDE,

How do I Implement an interface in IronRuby that includes CLR Events

落花浮王杯 提交于 2019-12-04 13:46:33
I'm experimenting with IronRuby and WPF and I'd like to write my own commands . What I have below Is as far as I can figure out. class MyCommand include System::Windows::Input::ICommand def can_execute() true end def execute() puts "I'm being commanded" end end But the ICommand interface defines the CanExecuteChanged event. How do I implement that in IronRuby? Edit: Thanks to Kevin's response Here's what works based on the 27223 change set of the DLR. The value passed in to can_execute and execute are nil. class MyCommand include System::Windows::Input::ICommand def add_CanExecuteChagned(h)

Would you recommend Iron Ruby, Iron Python, or PowerShell for making a C# application a script host?

爷,独闯天下 提交于 2019-12-04 02:41:22
Would you recommend Iron Ruby, Iron Python, or PowerShell for making a C# application a script host? After some quick tinkering, right now I'm leaning towards powershell for two main reasons (note these a purely my opinions and if they are wrong, I'd love to know!!!): 1) It's simple to create a runspace with classes in your application; therefor it's easy to make your application scriptable. 2) I've heard some rumors that IronRuby and IronPython are losing support from Microsoft, so they may be a poor long term solution? As this is my first time adding scripting to an application though, I'd

Is it possible to host the .Net DLR in an “idiot-proof” sandbox?

和自甴很熟 提交于 2019-12-03 06:49:52
I would like to host the Dynamic Language Runtime (DLR) in such a way that users who run arbitrary scripts in it cannot bring the process down? The DLR hosting spec describes how to host the DLR in a separate ApplicationDomain. This allows to tear down and unload a script runtime and to restrict certain operations through CAS (e.g. I can restrict file system access or disallow use of reflection). But are there also ways to for example: - restrict the maximum amount of memory used by a script? - restrict the number of threads created by a script? - detect deadlocked scripts? I think such fine