Question

I need it, but don't want to reinvent hot water.

Question by example, syntax just as possible example :

.net> load myLibrary.dll
myLibrary.dll loaded

.net> Person p "John" "Doo" 32
Instance of myLibrary.Person created (p)

.net> print p.Age
32

So I'm looking for a commandline interface to access the public methods and properties of an assembly. (In this example the Ctor of Person(string,string,int) was invoked and after that the property Age was printed to the console.)

Although I would be happy with any solution to this,

  • I need the sourcefiles to, so I can adapt them... (I prefere c# very much)
  • I need it to be free and redistributable

Any ideas?

UPDATE : If I cannot find a good solution, i will program it myself, anyone interested can contact me at gmail, that is phelsen at.

Was it helpful?

Solution

F# has a command-line REPL (fsi.exe). And the code for F# is available.

(See http://strangelights.com/fsharp/wiki/default.aspx/FSharpWiki/FSI.html for an old screenshot to get an idea.)

OTHER TIPS

For C# (original tags), this the type of thing that the "compiler as a service" will enable in some future version. However, you can do some of it already in mono (with source code available) - CsharpRepl. It should print the value of the last command - not quite the same as the Person description you wanted (I expect it'll use ToString()).

CsharpRepl
(source: mono-project.com)

You might want to look into Powershell, although there is no source available to my knowledge. The syntax isn't exactly C#, but it's fairly easy to pick up.

IronPython also has a REPL.

Have you tried PowerShell (formerly code named Monad)? It's a CLI, based on .NET, and with full access to assemblies, albeit with a different model than the 'load assembly' procedure you indicated.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top