gpt4 book ai didi

c# - Intellisense - 字符串中的 Javascript

转载 作者:行者123 更新时间:2023-11-30 18:55:21 25 4
gpt4 key购买 nike

我在字符串中有一个很长的 javascript,并使用 RegisterClientScriptBlock 以编程方式将其添加到我的页面。

有没有办法让智能感知检测字符串中的 javascript?

代码:

string Script0 =
@"
function dummy()
{
}

var PTRValues = new Array();
...
...
..
";

this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "myCustomScriptBlock", Script0, true);

最佳答案

不,您不能在 JS 字符串中获得智能感知。 IDE 不知道这个特定的字符串是 JS。

如果它很长,请不要将它放在 *.cs 文件中。而是将其存储在 *.js 中。如果您确实需要,您可以在运行时将文件加载到内存中,并将其嵌入到 html 中而不是引用中。

关于c# - Intellisense - 字符串中的 Javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2322170/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com