1 .列举 ASP.NET 页面之间传递值的几种方式。
答. 1).使用 QueryString, 如....?id=1; response. Redirect()....
2).使用 Session 变量
3).使用 Server.Transfer
2. 一列数的规则如下: 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);
}
}
3.C#中的委托是什么?事件是不是一种委托?
答 :
委托可以把一个方法作为参数代入另一个方法。
委托可以理解为指向一个函数的引用。
是,是一种特殊的委托
4.override 与重载的区别
答 :
override 与重载的区别。重载是方法的名称相同。参数或参数类型不同,进行多次重载以
适应不同的需要
Override 是进行基类中函数的重写。为了适应需要。
5. 如 果 在 一 个 B/S 结 构 的 系 统 中 需 要 传 递 变 量 值 , 但 是 又 不 能 使 用
Session、Cookie、Application,您有几种方法进行处理?
答 :
this.Server.Transfer
6.请编程遍历页面上所有 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 ;
}