A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 夏雪锐 黑马帝   /  2011-11-9 23:11  /  3038 人查看  /  1 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

在一个类的声明前面放这样一个东西:[DefaultEvent("InfoMessage")]
这是啥意思呀?还有我发觉一些方法前面也有一些中括号,里面什么些东西是什么意思呀?好心人赐教。

评分

参与人数 1技术分 +1 收起 理由
陈涛 + 1

查看全部评分

1 个回复

倒序浏览
你可以参看下微软提供的API。
  System.Data.SqlClient.SqlConnection  
  文件下都是定义,没有具体的实现,而我们能直接new SqlConnection  
  然后就直接使用它的方法。
  
C# code // 摘要:
    //     Represents an open connection to a SQL Server database. This class cannot
    //     be inherited.
    [DefaultEvent("InfoMessage")]
    public sealed class SqlConnection : DbConnection, ICloneable
    {
        // 摘要:
        //     Initializes a new instance of the System.Data.SqlClient.SqlConnection class.
        public SqlConnection();
        //
        // 摘要:
        //     Initializes a new instance of the System.Data.SqlClient.SqlConnection class
        //     when given a string that contains the connection string.
        //
        // 参数:
        //   connectionString:
        //     The connection used to open the SQL Server database.
        public SqlConnection(string connectionString);

        // 摘要:
        //     Gets or sets the string used to open a SQL Server database.
        //
        // 返回结果:
        //     The connection string that includes the source database name, and other parameters
        //     needed to establish the initial connection. The default value is an empty
        //     string.
        //
        // 异常:
        //   System.ArgumentException:
        //     An invalid connection string argument has been supplied, or a required connection
        //     string argument has not been supplied.
        [DefaultValue("")]
        [ResDescription("SqlConnection_ConnectionString")]
        [RecommendedAsConfigurable(true)]
        [RefreshProperties(RefreshProperties.All)]
        [ResCategory("DataCategory_Data")]
        [Editor("Microsoft.VSDesigner.Data.SQL.Design.SqlConnectionStringEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
        public override string ConnectionString { get; set; }
        //
        // 摘要:
        //     Gets the time to wait while trying to establish a connection before terminating
        //     the attempt and generating an error.
        //
        // 返回结果:
        //     The time (in seconds) to wait for a connection to open. The default value
        //     is 15 seconds.
        //
        // 异常:
        //   System.ArgumentException:
        //     The value set is less than 0.
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        [ResDescription("SqlConnection_ConnectionTimeout")]
        public override int ConnectionTimeout { get; }
        //
        // 摘要:
        //     Gets the name of the current database or the database to be used after a
        //     connection is opened.
        //
        // 返回结果:
        //     The name of the current database or the name of the database to be used after
        //     a connection is opened. The default value is an empty string.
        [ResDescription("SqlConnection_Database")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public override string Database { get; }
        //
        // 摘要:
        //     Gets the name of the instance of SQL Server to which to connect.
        //
        // 返回结果:
        //     The name of the instance of SQL Server to which to connect. The default value
        //     is an empty string.
        [Browsable(true)]
        [ResDescription("SqlConnection_DataSource")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public override string DataSource { get; }

评分

参与人数 1技术分 +1 收起 理由
陈涛 + 1

查看全部评分

回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马