C# Console? [closed]
Asked Answered
H

7

28

Does anyone know if there is a c# Console app, similar to the Python or Ruby console? I know the whole "Compiled versus Interpreted" difference, but with C#'s reflection power I think it could be done.

UPDATE Well, it only took about 200 lines, but I wrote a simple one...It works a lot like osql. You enter commands and then run them with go.

SharpConsole http://www.gfilter.net/junk/sharpconsole.jpg

If anyone wants it, let me know.

Hyozo answered 6/9, 2008 at 15:8 Comment(7)
Awesome! Where could one download your console??Grindelia
The image is broken.Shithead
I'd like to try your app/solution as well. Any thought to releasing/sharing the app and or its source code? Perhaps host on GitHub, SourceForge, or CodePlex. I assume it would be easy to compile from source as it's only 200 lines.Tu
@Hyozo hasn't been online since Jan '11Webb
@Webb It makes me think the guy might even have passed away. It's sad , but under what other circumstances someone with 46k rep would just abandon the account?Toast
@Webb Worst of all is that I can't even google the guy, with a nick like that. If he did pass away, some relative might like to hear that even with zero activity for two years, he still is a top 0.31% user with a huge reputation that keeps rising even long after he made contributions to a mostly-meritocratic community where reputation is mostly correlated with being a nice guy.Toast
The best Option is using CSharpRepl take a look at my answer: https://mcmap.net/q/13746/-c-repl-outside-visual-studioGrams
I
19

Given your mention of "C#'s reflection power", I am unsure whether you're looking for an interactive C# console for small code snippets of your own (à la Ruby's irb), or a means of interacting with an existing, compiled application currently running as a process.

In the former case:

  • Windows PowerShell might be your friend
  • Another candidate would be the C# shell
  • Finally, CSI, a Simple C# Interpreter
Italianism answered 6/9, 2008 at 15:19 Comment(2)
That C# shell isn't a shell at all. It does takes your shebang prefixed "script" and wraps it up in Main(){}Tetravalent
Powershell isn't ideal if you don't want the hassle to learn and use a new scripting/coding syntax. It's different from C#. Wish Powershell was more like Beanshell is to Java.Tu
S
9

Found this on reddit: http://tirania.org/blog/archive/2008/Sep-08.html

Quote from the site:

The idea was simple: create an interactive C# shell by altering the compiler to generate and execute code dynamically as opposed to merely generating static code.

Stringfellow answered 9/9, 2008 at 6:37 Comment(0)
E
8

If you don't have to use the console, and just want a place to test some ad hoc C# snippets, then LinqPad is a good option. I find it very cool/easy to use.

Ethbun answered 14/10, 2008 at 23:2 Comment(1)
This is a great tool for the job, thanks! I had it already but had never tried it just to run code. It's nice because it also runs VB, and can run expressions or statements, as well as obviously execute LINQ2SQL against a live database, and run regular SQL queries.Earlie
M
6

I am not sure what you are looking for this application to accomplish. If it is just to try some code without having to create a project and all the overhead to just test an idea, then SnippetCompiler could be a good fit.

I just wanted to give you another option.

Megavolt answered 6/9, 2008 at 18:31 Comment(1)
Not as quick and easy as script interpreters, but by far the most useful that I've tried. Nice to be able to easily add a bunch of references to my libraries. Thanks Dale!Adjectival
H
3

It appears Miguel De Icaza was stalking me:

http://tirania.org/blog/archive/2008/Sep-08.html

Hyozo answered 9/9, 2008 at 19:44 Comment(0)
M
1

Google reveals a few efforts at this. One in particular illustrates why this is less straightforward than it might seem. http://www.codeproject.com/KB/cs/csi.aspx has a basic interpreter using .NET's built in ability to compile c# code. A key problem is that the author's approach creates a new mini .NET assembly for each interpreted line. C# may have the reflective power to have a python or ruby style console, but the .NET framework libraries are geared toward compiling C#, not dynamically interpreting it. If you are serious about this, you may want to look at http://www.paxscript.net/, which seems like a genuine attempt at interpreted C#.

Mernamero answered 6/9, 2008 at 15:27 Comment(0)
D
1

I believe you are looking for Snippy =)

Snippy Screenshot

Dmso answered 5/2, 2009 at 23:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.