如果想得到sql的受影响行集(前提是你没定set nocount on,而且不是select语句,只是想知道insert/update/delete成没成功),你可以使用SqlReader的RecordsAffected属性,如果你用的是SqlCommand的ExecuteNonQuery(),没用到SqlReader,该方法会返回一个整数值,代表受影响的行集,如果没有的话记住是-1而不是0
MultiExtended和multisimple的区别:一般选MultiExtended,按住鼠标拖就成了,multisimple不能拖,只能一个一个点
静态类不允许继承自其他类(只能继承object类)~
-
- The class may not derive from anything other than
System.Object
, and if you don’t specify any base type, then derivation fromSystem.Object
is implied.
- The class may not derive from anything other than
-
- The class may not be used as a base class of another class.
-
- The class can only contain static members, which can be public or private. However, they cannot be marked
protected
orprotected internal
, since the class cannot be used as a base class.
- The class can only contain static members, which can be public or private. However, they cannot be marked
-
- The class may not have any operators, since defining them would make no sense if you cannot create instances of the class.
null 的区别String.Empty:
String.Empty means the variable references a string with no characters, eg ""
MemoryStream memoryStream = new MemoryStream();
XmlSerializer xs = new XmlSerializer(typeof(int[]));
XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);
xs.Serialize(xmlTextWriter, list);
memoryStream = (MemoryStream)xmlTextWriter.BaseStream;
UTF8Encoding encoding = new UTF8Encoding();
String constructedString = encoding.GetString(memoryStream.ToArray());
C# 构造函数调用构造函数
class myClass
{
pulbic myClass()
{
}
public myClass(string s) : this()
{
}
}
给按钮添加快捷键:&键名就可以了,比如button1.text= "确定(&O)"。此时按alt、control、shift+O都会触发按键事件