How do I use Debug.Writeline in a razor file?

自作多情 提交于 2019-12-24 17:06:16

问题


I'm trying to use Debug.Writeline in a razor web page and I keep getting invalid arguments messages.

@System.Diagnostics.Debug.WriteLine("asdf");

returns

CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments


回答1:


Debug.WriteLine does not return a value so it can't be written out using @. Try:

@{System.Diagnostics.Debug.WriteLine("asdf");}


来源:https://stackoverflow.com/questions/21638874/how-do-i-use-debug-writeline-in-a-razor-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!