zoukankan
html css js c++ java
C#中 @ 的用法
using
System.Data.SqlClient;
using
System.Data;
using
System;
class
MyClass
{
void
Test()
{
//
1 加在字符串前面,字符串中的 \ 失去转义符的作用,直接写字符串而不需要考虑转义字符
string
path
=
@"
C:\Windows\
"
;
//
如果不加 @,编译会提示无法识别的转义序列
//
如果不加 @,可以写成如下
string
path2
=
"
C:\\Windows\\
"
;
//
2 加在字符串前面,字符串中的 " 要用 "" 表示
string
str
=
@"
aaa=""bbb""
"
;
//
不加 @,可以写成
string
str2
=
"
aaa=\
"
bbb\
""
;
//
3 加在字符串前面,换行空格都保存着,方便阅读代码
string
insert
=
@"
insert into Users
(
UserID,
Username,
Email
) values
(
@UserID,
@Username,
@Email
)
"
;
//
4 用关键字做变量时在关键字前面加@
string
@operator
=
"
+
"
;
string
@class
=
"
分类一
"
;
Console.WriteLine(@operator);
Console.WriteLine(@class);
//
5 作为sql语句里的一个“标签”,声明此处需要插入一个参数
string
delete
=
"
delete from Categery where CategoryID=@CategoryID
"
;
SqlConnection connection
=
new
SqlConnection(
"
connectionString
"
);
SqlCommand command
=
new
SqlCommand(delete, connection);
command.Parameters.Add(
"
@CategoryID
"
, SqlDbType.BigInt);
}
//
Test()
}
//
class MyClass
查看全文
相关阅读:
贪吃蛇—C—基于easyx图形库(上):基本控制函数实现 画图程序
ubuntu之路——day7.3 normalizing input(加快迭代速度)
ubuntu之路——day7.2 regularization
ubuntu之路——day7.1 衡量模型好坏的因素偏差和方差bias&variance 以及在深度学习中的模型优化思路
ubuntu之路——day6(今天对数据集的建立有了更深的体会)
ubuntu之路——day5(今天看了浅层神经网络的数学推导过程)
ubuntu之路——day4(今天主要看了神经网络的概念)
python format 时间格式
ubuntu之路——day3(本来打算做pytorch的练习 但是想到前段时间的数据预处理的可视化分析 就先总结一下)
ubuntu之路——day2
原文地址:https://www.cnblogs.com/yangbin1005/p/1171581.html
最新文章
prototype与 _proto__的关系
webpack——简单入门
CDN实现原理
Javascript实现10种排序算法
JavaScript 编译器-Babel
90后,为什么我建议你不要老是加班?
圣杯布局和双飞翼布局的理解与思考
requests库session保持持久会话
https校验问题
unittest基础篇1
热门文章
range函数
python多版本切换
tree目录结构
MacOS常用命令行工具
Sublime Python3编译环境修改
允许安装任何来源应用
pip安装
字符串格式化str.format
第三方库安装
贪吃蛇—C—基于easyx图形库(下):从画图程序到贪吃蛇【自带穿墙术】
Copyright © 2011-2022 走看看