【发布时间】:2012-08-08 13:57:08
【问题描述】:
这将是我在这里的第一个问题,所以请宽容。
这怎么可能:
//there is a Form1 class which has a TableAdapter member generated by designer...
partial class Form1
{
private void InitializeComponent()
{
this.SomeTableTableAdapter = new SomeDatabaseDataSetTableAdapters.SomeTableTableAdapter();
}
private SomeDatabaseDataSetTableAdapters.SomeTableTableAdapter SomeTableTableAdapter;
}
//here is this TableAdapter class
//It has PROTECTED member called "Adapter"
public partial class SomeTableTableAdapter : global::System.ComponentModel.Component
{
protected internal global::System.Data.SqlClient.SqlDataAdapter Adapter
{
}
}
//and in the constructor of Form1 class I can do something like this:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.SomeTableTableAdapter.Adapter.InsertCommand.CommandText = @"INSERT INTO (...)";
}
}
Form1 不是从 SomeTableTableAdapter 继承的,我怎么能访问受保护的成员?
【问题讨论】:
-
请使用网站功能回复答案,例如发表评论。由于这是一个问答网站,因此实际上不是答案的答案will be removed。不要忘记将答案标记为已接受。
标签: c# .net winforms protected access-modifiers