简述 private、 protected、 public、 internal 修饰符的访问权限。
.private :
私有成员
,
在类的内部才可以访问。
protected :
保护成员,该类内部和继承类中可以访问。
public :
公共成员,完全公开,没有访问限制。
internal:
在同一命名空间内可以访问。
.列举 ASP.NET 页面之间传递值的几种方式。
1.使用 QueryString, 如....?id=1; response. Redirect()....
2.使用 Session 变量
3.使用 Server.Transfer
一列数的规则如下: 1、1、2、3、5、8、13、21、34...... 求第 30 位数是多少, 用递归算法
实现。
答:public class MainClass
{
public static void Main()
{
Console.WriteLine(Foo(30));
}
public static int Foo(int i)
{
if (i <= 0)
return 0;
else if(i > 0 && i <= 2)
return 1;
else return Foo(i -1) + Foo(i - 2);
}
}
请编程遍历页面上所有 TextBox 控件并给它赋值为 string.Empty?
答:
foreach (System.Windows.Forms.Control control in this.Controls)
{
if (control is System.Windows.Forms.TextBox)
{
System.Windows.Forms.TextBox tb = (System.Windows.Forms.TextBox)control ;
tb.Text = String.Empty ;
}
}
请编程实现一个冒泡排序算法?
答:
int [] array = new int [*] ;
int temp = 0 ;
for (int i = 0 ; i < array.Length - 1 ; i++)
{
for (int j = i + 1 ; j < array.Length ; j++)
{