如何快速编码和运行小的 C# 代码 [英] How to quickly code and run small C# code

查看:22
本文介绍了如何快速编码和运行小的 C# 代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时我想测试来自论坛的新代码,或者我需要帮助我的朋友解决特定的 C# 问题.问题是我不想每次都在 Visual Studio 中创建新的项目"只是为了编码/运行这个小代码.

There are times when I want to test new code from the forums or when I need to help my friends with specific C# problem. The problem is I don't want to create new "project" in Visual Studio each time just to code/run only this small code.

Java &Eclipse IDE 提供了允许执行任意 Java 表达式的剪贴簿"功能.C#程序员有哪些选择?

Java & Eclipse IDE comes up with "Scrapbook" feature which allows the execution of arbitrary Java expressions. What are the choices for C# programmers?

推荐答案

Snippet Compiler 非常适合这个.

Snippet Compiler is great for this.

LINQPad 也适用于测试各种 C#、F# 或 VB 代码,而不仅仅是 LINQ查询.

LINQPad is also good for testing out all sorts of C#, F# or VB code, not just LINQ queries.

编辑

我想是时候提一下 Snippet Compiler 已经超过五年没有更新了,因此不再是最佳选择.

I suppose it's time that I mention that Snippet Compiler hasn't been updated in over five years, and is therefore no longer the best option.

然而,我最初低估了 LINQPad.正如 Will Dean 在评论中提到的,LINQPad 非常适合各种代码,而不仅仅是 LINQ 查询.事实上,它已经成为我不可或缺的工具.我每天都使用它,不仅可以快速测试短片,还可以测试相对复杂的小程序.其先进的输出格式使得快速检查中间和最终结果变得非常容易.

However, I undersold LINQPad originally. As Will Dean mentioned in the comments, LINQPad is excellent for all sorts of code, not just LINQ queries. In fact, it has become an indispensable tool for me. I use it daily, not only to quickly test out short snippets, but for relatively complex mini programs. Its advanced output formatting makes it extremely easy to quickly examine intermediate and final results.

这篇关于如何快速编码和运行小的 C# 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆