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.)
所以我正在寻找一个命令行界面来访问程序集的公共方法和属性。 (在此示例中,调用了人员的Ctor(字符串,字符串,整数),之后将属性Age打印到控制台。)
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
我需要源文件,所以我可以适应它们...(我非常喜欢c#)
我需要它是免费的和可再发行的
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.
更新:如果我找不到一个好的解决方案,我会自己编程,有兴趣的人可以通过gmail与我联系,即phelsen at。
5 个解决方案
#1
F# has a command-line REPL (fsi.exe). And the code for F# is available.
F#有一个命令行REPL(fsi.exe)。并且F#的代码可用。
(See http://strangelights.com/fsharp/wiki/default.aspx/FSharpWiki/FSI.html for an old screenshot to get an idea.)
(请参阅http://strangelights.com/fsharp/wiki/default.aspx/FSharpWiki/FSI.html获取旧屏幕截图以获取创意。)
#2
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()
).
对于C#(原始标签),这是“编译器即服务”在未来某个版本中将启用的类型。但是,您可以使用单声道(可使用源代码)执行其中一些操作 - CsharpRepl。它应该打印最后一个命令的值 - 与你想要的Person描述不完全相同(我希望它将使用ToString())。
CsharpRepl http://mono-project.com/files/thumb/9/96/320px-Xbyhja.png
#3
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.
您可能想要查看Powershell,尽管我的知识没有可用的来源。语法不完全是C#,但它很容易上手。
#5
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.
您是否尝试过PowerShell(以前代号为Monad)?它是一个基于.NET的CLI,可以完全访问程序集,虽然模型与您指定的“加载程序集”过程不同。
#1
F# has a command-line REPL (fsi.exe). And the code for F# is available.
F#有一个命令行REPL(fsi.exe)。并且F#的代码可用。
(See http://strangelights.com/fsharp/wiki/default.aspx/FSharpWiki/FSI.html for an old screenshot to get an idea.)
(请参阅http://strangelights.com/fsharp/wiki/default.aspx/FSharpWiki/FSI.html获取旧屏幕截图以获取创意。)
#2
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()
).
对于C#(原始标签),这是“编译器即服务”在未来某个版本中将启用的类型。但是,您可以使用单声道(可使用源代码)执行其中一些操作 - CsharpRepl。它应该打印最后一个命令的值 - 与你想要的Person描述不完全相同(我希望它将使用ToString())。
CsharpRepl http://mono-project.com/files/thumb/9/96/320px-Xbyhja.png
#3
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.
您可能想要查看Powershell,尽管我的知识没有可用的来源。语法不完全是C#,但它很容易上手。
#4
IronPython also has a REPL.
IronPython也有一个REPL。
#5
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.
您是否尝试过PowerShell(以前代号为Monad)?它是一个基于.NET的CLI,可以完全访问程序集,虽然模型与您指定的“加载程序集”过程不同。