首页 > 其他 > 详细

@符号的作用

时间:2020-05-01 21:10:04      阅读:68      评论:0      收藏:0      [点我收藏+]

 学习记录 

原文链接: https://www.cnblogs.com/cn-star/p/11872017.html

 

 “@”符号有如下三种作用:

  •    忽略转义字符的作用:

       例如,有时我们保存一条文件路径时;路径中“\”需要写成“\\”;第一眼看去容易让人混淆。而通过字符串前加@符号,就可以直接输入路径,忽略转义。

           string sPath = "D:\\192.168.12.34\\USER\\LOCAL.jpg";

           string sPathV = @"D:\192.168.12.34\USER\LOCAL.jpg";

                 输出结果为:

                         技术分享图片

  • 让字符串跨行

         未加“@”前:

           string str = "select * from U_Wippackage_notice "
                            + "where id=‘123456‘"
                               + " and name=‘张三‘";        

         加了“@”后:

            string str1 = @"select * from U_Wippackage_notice
                               where id=‘123456‘ 
                                   and name=‘李四‘";

 

  •  使关键字可以作为(类名、变量名、方法名、表空间名等)使用

 

    技术分享图片

 

    

@符号的作用

原文:https://www.cnblogs.com/susiesnai-sun/p/12814363.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!