Search the Internet for a 籮 basket of C # problem, now sorted, put here, I hope to be able to help you reader
1. Briefly describe the access rights of private, protected, public, and internal modifiers.
For. Private: Privately owned members that are accessible within the class.
Protected: Protects members that are accessible within the class and in inheriting classes.
Public: Publicly members, fully exposed, without access restrictions.
Internal: can be accessed within the same namespace.
2. Enumerate several ways of passing values between asp.net pages.
A. 1. Use querystring, such as ...? id=1;
2 response. Redirect () ....
3. Use of Server.Transfer
4.application
5.sseion
6.cookies
7.server
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 is the delegate in the 4.c#. An event is not 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 the variable value in a B/s structure system, but you cannot use session, Cookie, application, you have several ways to handle it.
For:
This. Server.Transfer
redirect
7. Programmatically iterate through all the TextBox controls on the page and assign them a value of 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. Please 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)
{
temp = array;
Array = array[j];
ARRAY[J] = temp;
}
}
}
9. Describe the implementation of the indexer in C # and whether it can only be indexed by numbers.
Answer: No. 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 ();
11. NET to do b/s structure of the system, you are using several layers of structure to develop, the relationship between each layer and why this layering.
A: generally 3 floors
Data access layer, business layer, presentation layer.
The data access layer checks the database for additions and deletions.
The business layer generally divides into two layers, the business apparent layer realizes with the presentation layer communication, the business rule layer realizes the user password security and so on.
The presentation layer adds a form in order to interact with the user, such as a user.
Advantages: Clear division of labor, clear, easy to debug, and scalable.
Disadvantage: Increase the cost.
12. In the following example
Using System;
Class A
{
Public A ()