2. Enumerate several ways of passing values between asp.net pages.
A. 1). Use querystring, such as ...? id=1; Response. Redirect () ....
2). Using Session Variables
3). Using Server.Transfer
3. The rules for a number of columns are as follows: 1, 1, 2, 3, 5, 8, 13, 21, 34 ... Find the number of the 30th digits, using a recursive algorithm to achieve.
Answer: 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);
}
}
What are the delegates in the 4.c#? is an event a delegate?
For:
A delegate can substitute a method as a parameter into another method.
A delegate can be understood to point to a reference to a function.
Yes, it's a special kind of delegation.
The difference between 5.override and overload
For:
The difference between override and overloading. Overloading is the same as the name of the method. Different parameters or parameter types, multiple overloads to accommodate different needs
Override is an override of a function in a base class. In order to meet the needs.
6. If you need to pass variable values in a B/s structure system, but you can't use session, Cookie, application, how many ways do you handle it?
Answer: QueryString, FormsAuthentication, this. Server.Transfer
7. Do you programmatically traverse all TextBox controls on the page and assign values to String.Empty?
For:
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;
}
}
8. Do you implement a bubble sort algorithm programmatically?
For:
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 + +)
{
if (Array[j] < array[i])
{
temp = Array[i];
Array[i] = Array[j];
ARRAY[J] = temp;
}
}
}
9. Describe the implementation process of the indexer in C #, can you index it only according to the number?
Answer: You can use any type.
10. Ask for the value of the following expression, write one or more of the ways you want to implement it: 1-2+3-4+......+m
For:
int Num = this. TextBox1.Text.ToString ();
int Sum = 0;
for (int i = 0; i < Num + 1; i++)
{
if ((i%2) = = 1)
{
Sum + = i;
}
Else
{
Sum = Sum-i;
}
}
System.Console.WriteLine (Sum.tostring ());
System.Console.ReadLine ();
12. In the following example
Using System;
Class A
{
Public A ()
{
Printfields ();
}
public virtual void Printfields () {}
}
Class B:a
{
int x=1;
int y;
Public B ()
{
Y=-1;
}</