在字符串中使用//在c#asp.net中 [英] use // in c# asp.net in string

查看:61
本文介绍了在字符串中使用//在c#asp.net中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好
我想在字符串中使用``//''
"http://..."
但是c#''//''按照描述使用
我该如何插入?

hello
i want use ''//'' in string
"http://..."
but c# ''//''Uses as described
How do I insert this؟

推荐答案

单引号不表示字符串,而是表示单个字符.请改用双引号.

"http://www."

您是说"\\"吗?如果是这样,请在您的字符串前加上一个"@"字符:

字符串s = @"\\ GRIFFPC";
Single quote does not denote a string, it denotes a single character instead. Use double quotes instead.

"http://www."

Do you mean "\\" instead? If so, then prefix your string with an ''@'' character:

string s = @"\\GRIFFPC";


为什么不这样做:
Why not just do:
string url = @"http://www.google.com";


给出的答案足以说明问题,如果您想尝试更多内容,请阅读字符串文字.这是一个起点

http://msdn.microsoft.com/en-us/library/aa691090 (v = vs.71).aspx [
The answers given are sufficient explanation, if you want to venture more, read about string literals. Here is a starting point

http://msdn.microsoft.com/en-us/library/aa691090(v=vs.71).aspx[^]


这篇关于在字符串中使用//在c#asp.net中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆