.net怎么办怎么办

来源:互联网 发布:java中的for循环 编辑:程序博客网 时间:2024/05/21 15:05

     如果想得到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 from System.Object is implied.
  • 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 or protected internal, since the class cannot be used as a base class.
  • 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:

       Null means the variable has no reference set
       String.Empty means the variable references a string with no characters, eg ""      
         To be sure use String.IsNullOrEmpty (http://msdn.microsoft.com/en-us/library/system.string.isnullorempty(VS.80).aspx).
      你想改变Dictionary<>的key值 ?没有直接的方法,只能删了再添~
       数组序列化为XML格式

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都会触发按键事件

原创粉丝点击