理论上来说,我可以使用IronRuby来编写所有c#可以编写的应用程序,对吗?

发布于 2024-09-06 16:05:11 字数 156 浏览 10 评论 0原文

我了解一些Ruby 语言。现在我需要做一些.net 开发。我不想学习一门新语言。因此,在谷歌搜索后我得到了IronRuby。现在我的问题是我可以使用 IronRuby 编写所有 C# 可以编写的应用程序吗?

谢谢。

I know some ruby language. Now I need do some .net development. I don't want to learn a new language. So, after googling I got IronRuby. Now my question is Can I use IronRuby to write all apps that c# can write?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

儭儭莪哋寶赑 2024-09-13 16:05:11

从广义上讲,我相信您应该能够做几乎所有可以用 C# 做的事情。然而,在某些领域,C# 可能会让您的事情变得更容易 - 该框架在设计时肯定考虑到了静态类型语言。

LINQ 是确实令人担忧的一个领域。我不知道 IronRuby 是否直接支持表达式树。当然,您可以手动创建它们,但这将是一次非常糟糕的体验。同样,我不知道 IronRuby 会如何推断 LINQ to Objects 等的相关委托类型。

不要太害怕学习一门语言:这是一种可以显着拓宽思维的体验。鉴于您已经必须至少在某种程度上学习 .NET 框架,您不妨学习编写该框架的大多数示例所用的语言。如果这是一个相当大的项目,我怀疑总的来说,你会节省时间,当然,也会因此获得更广泛的知识。

另一件需要考虑的事情是谁将维护代码库。您还没有说明为什么需要进行此开发 - 但如果是出于专业原因,从长远来看,您可能要么有同事,要么必须将代码交给某人。了解他们的偏好是什么。

Broadly speaking, I believe you should be able to do almost anything you can do in C#. However, there may be some areas where C# makes things easier for you - the framework was certainly designed with statically typed languages in mind.

One area which does raise a spectre is LINQ. I don't know whether IronRuby supports expression trees at all directly. You could create them manually of course, but that would be a pretty poor experience. Likewise I don't know what IronRuby would do about inferring the relevant delegate types for LINQ to Objects etc.

Don't be too afraid of learning a language: it's an experience which can broaden the mind significantly. Given that you're already going to have to learn the .NET framework to at least some extent, you might as well learn the language which most of the examples of the framework are written in. If this is a reasonably large project, I suspect that overall you'll save time - and, of course, have a broader knowledge as a result.

Another thing to consider is who's going to maintain the code base. You haven't said why you need to do this development - but if it's for a professional reason, presumably you'll either have colleagues or have to hand the code over to someone in the long run. Find out what their preference is.

拒绝两难 2024-09-13 16:05:11

是的,您可以使用 IronRuby 来编写应用程序,但是使用 Ruby,其支持和在线社区不会像 C# 那样成熟。因此,如果您学习 C# 并编写应用程序,您会发现它会更容易一些。这是我个人的看法。

IronRuby只是Ruby除了C、Java等之外又多了一种实现语言,这并不意味着你可以用C#进行编码。您将只使用 Ruby 语言进行编码,您可以享受它的所有优点并处理它的缺点。

因此,您的问题的答案是,您使用 IronRuby、JRuby 还是 (C)Ruby 并不重要。

Yes, you can use IronRuby to write Apps, but with Ruby the support and online community will not be as matured as C# is. So, you would find it a bit easier if you learn C# and write applications. This is my personal opinion.

IronRuby is just one more implementation language that Ruby has besides C, Java etc., This does not mean that you can do coding in C#. You will be coding only in Ruby language and you can enjoy all its pros and deal with it cons.

So, the answer to your question is, whether you use IronRuby or JRuby or (C)Ruby does not really matter.

流殇 2024-09-13 16:05:11

我认为您在这里真正想问的是以下两件事之一:

  • 我可以使用 IronRuby 与现有 .NET 和基于 .NET 的库进行交互,像 C# 语言程序一样进行交互吗?

    答案是肯定的,大部分。您无法直接执行的主要部分是直接连接 Win32 API 调用,就像 C# 与 P/Invoke。 P/Invoke 之于 C# 基本上就像 FFI 之于 Ruby。如果您不关心这一点,那就太好了。

  • 我可以写任何算法/结构/构造/等吗?在 Ruby 语言中我可以在 C# 语言中吗?

    这是对你的问题的实际措辞的更字面的解释,但我不认为这就是你想问的,因为如果不涉及一些相当沉重的理论,答案就更加模糊。所以,我们只会说“当然”。

I think what you really want to be asking here is one of two things:

  • Can I use IronRuby to interface with existing .NET and .NET-based libraries, interacting as a C#-language program would?

    The answer is yes, well, mostly. The primary section you will not be able to do directly is to interface Win32 API calls directly in the same way C# does with P/Invoke. P/Invoke is basically to C# what FFI is to Ruby. If you don't don't care about that, great.

  • Can I write any algorithm/structure/construct/etc. in the language Ruby that I can in the language C#?

    This is the more literal interpretation of the actual wording of your question, but I don't think it's what you meant to ask, as the answer is more nebulous without getting into some pretty heavy theory. So, we'll just say 'sure'.

神经暖 2024-09-13 16:05:11

您的问题的一般答案是肯定的 - 您可以在 C# 中执行的所有操作都可以在 IronRuby 中执行,反之亦然。然而,每种语言都有自己的优点和缺点......例如,Ruby 具有 C# 只能梦想的强大元编程功能。另一方面,C# 有 LINQ。

至于社区,我认为没有太大区别。通过 IronRuby,您可以获得 Ruby 社区和 IronRuby 社区。通过 C#,您可以获得 .NET 社区和 MSDN...

选择编程语言是一种宗教问题...您会选择哪种语言 - 基督教、犹太教还是伊斯兰教?只有你自己才能知道...:-)

The general answer to your question is yes - everything you can do in C# you can do in IronRuby and vice versa. However, every language has its own advantages and disadvantages... for example, Ruby has awesome metaprogramming capabilities that C# can only dream of. On the other hand, C# has LINQ.

Regarding the community, I don't think there is much of a difference. With IronRuby you get the Ruby community and the IronRuby community. With C# you get the .NET community and MSDN...

Choosing a programming language is kind of a religious question... what would you go with - Christianity, Judaism or Islam? only you can tell... :-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文