我编写的应用程序可以在命令行上运行,也可以使用WPF UI运行.
[STAThread]
static void Main(string[] args)
{
// Does magic parse args and sets IsCommandLine to true if flag is present
ParseArgs(args);
if(IsCommandLine)
{
// Write a bunch of things to the console
}
else
{
var app = new App();
app.Run(new Window());
}
}
Run Code Online (Sandbox Code Playgroud)
我将项目的输出类型设置为控制台应用程序,如果我尝试通过双击exe来执行它,我会弹出一个控制台窗口.如果未设置标志(通过命令args传入),我不想向用户显示控制台窗口.
但是,如果我将项目的输出类型设置为Windows应用程序,则双击行为很好,但是当我在控制台中运行它时,我没有控制台输出(Console.Writeline)
如何让MiniProfiler分析我的ajax请求
例如:
<div id="nav">
<ul>
<li onclick="javascript:updateContent(1);">foo 1</li>
<li onclick="javascript:updateContent(2);">foo 2</li>
<li onclick="javascript:updateContent(3);">foo 3</li>
</ul>
</div>
<div id="content"></div>
<script type="text/javascript">
function updateContent(productId) {
$.ajax({
url: '@Url.Action("GetProduct", "Product")',
contentType: 'application/html; charset=utf-8',
type: 'GET',
dataType: 'html',
traditional: true,
data: {
productId: productId
}
})
.success(function (result) {
// Display the section contents.
$('#content').html(result);
})
.error(function (xhr, status) {
alert(xhr.responseText);
});
}
</script>
Run Code Online (Sandbox Code Playgroud)
我想看看每个updateContent的性能.
有任何想法吗?
我正在使用通过NuGet安装的Asp.net MVC 3和MiniProfiler 1.9
我的系统中有遗留消息,我希望能够将新消息映射到我的系统中.
为什么我不能重载我的case类?
case class Message(a:Int, b:Int)
case class NewMessage(a:Int, b:Int, c:Int) {
def this(msg : Message) = this(a = msg.a, b = msg.b, c = 0)
}
val msg = Message(1,2)
val converted = NewMessage(msg)
Run Code Online (Sandbox Code Playgroud)
这段代码似乎没有编译.:(