C # interview FAQ 1

Source: Internet
Author: User
Tags finally block
Share the C # Interview Questions found on the Internet





2. List several methods for passing values between ASP. NET pages.
A. 1). Use querystring, such ....? Id = 1; response. Redirect ()....
2). Use session Variables
3). Use server. Transfer



3. The rule for a column is as follows: 1, 1, 2, 3, 5, 8, 13, 21, 34 ...... calculate the number of digits 30th, and use recursion.Algorithm.
A: 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 );
}
}



4. What is the delegate in C? Is an event a delegate?
A:
A delegate can substitute a method as a parameter into another method.
A delegate can be understood as a reference to a function.
Yes, it is a special delegate



5. Differences between override and overload
A:
The difference between override and overload. Overload means that the method name is the same. The parameters or parameter types are different and are reloaded multiple times to meet different needs.
Override is used to override functions in the base class. To meet your needs.



6. If you need to pass variable values in a B/S system, but you cannot use session, cookie, and application, how can you handle them?
A:
This. server. Transfer



7. programmatically traverse all textbox controls on the page and assign it a string. Empty?
A:
Foreach (system. Windows. Forms. 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. How can I program a Bubble sorting algorithm?
A:
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. To describe the implementation process of the indexer in C #, can it be indexed only by numbers?
A: No. Any type can be used.



10. Evaluate the values of the following expressions and write out one or more implementation methods: 1-2 + 3-4 + ...... + M
A:
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
{
Public ()
{
Printfields ();
}
Public Virtual void printfields (){}
}
Class B:
{
Int x = 1;
Int y;
Public B ()
{
Y =-1;
}
Public override void printfields ()
{
Console. writeline ("x = {0}, y = {1}", x, y );
}
What is the output when new B () is used to create B's instance?
Answer: x = 1, y = 0; X = 1 y =-1



13. What is an application?ProgramDomain?
A: The application domain can be considered as a lightweight process. Security. Small resource occupation.



14. What are the explanations of CTS, CLS, and CLR?
A: CTS: a general-purpose language system. CLS: general language specification. CLR: Common Language Runtime Library.



15. What is packing and unpacking?
A: From the value type interface to the Reference Type Packing. Converts a reference type to a value type Unbox.



16. What is regulated?Code?
A: unsafe: unmanaged code. Does not run through CLR.



17. What is a strong system?
A: rtti: The type recognition system.



Which classes are required for reading and writing databases in 18.net? What are their roles?
Answer: Dataset: data storage.
Datacommand: Execute the statement command.



21. In. net, what does the accessory mean?
A: assembly. (Intermediate language, source data, resources, assembly list)



22. What are common WebService call methods?
A: 1.use the wsdl.exe command line tool.
2. Use the Add web reference menu option in vs. net



What is the working principle of 23..net remoting?
A: the server sends a process number and a program domain number to the client to determine the object location.



29. Based on the knowledge of thread security, analyze the following code. Will the deadlock occur when I> 10 is called when the test method is called? And briefly explain the reasons.
Public void test (int I)
{
Lock (this)
{
If (I> 10)
{
I --;
Test (I );
}
}
}
A: No deadlock will occur (but one int is passed by value, so each change is only a copy, so no deadlock will occur. But if you replace int with an object, the deadlock will occur)



30. Briefly discuss your understanding of the remoting and WebService technologies under the Microsoft. NET architecture and their practical applications.
A: Ws uses http to penetrate the firewall. Remoting can improve the efficiency by using TCP/IP and binary transmission.



Remoting is. net is used to call methods across machine, process, and appdomain. For a three-structure program, remoting technology can be used to construct the program. it is the basic technology for distributed applications. similar to the previous DCOM web service, it is a common model for building applications and can be implemented on all operating systems that support Internet communication. Web service enables the combination of component-based development and web to achieve the best, component-based object model



31. the company requires the development of an inherited system. windows. forms. listview components require the following special features: When you click the headers of columns in the listview, all rows in the view can be rearranged based on the values of each row in the click column (the sorting method is similar to that in the DataGrid ). Based on your knowledge, please briefly discuss your ideas
A: Based on the column header that you click, the ID of this column is taken out, sorted by this ID, and bound to listview.



32. Specify the following XML file to complete the algorithm flow chart.
<Filesystem>
<Driverc>
<Dir dirname = "msdos622">
<File filename = "command.com"> </File>
</Dir>
<File filename = "msdos. sys"> </File>
<File filename = "Io. sys"> </File>
</Driverc>
</Filesystem>
Draw a flowchart that traverses all file names (filename) (use recursive algorithms ).
A:
Void findfile (Directory D)
{
Fileorfolders = D. getfileorfolders ();
Foreach (fileorfolder fof in fileorfolders)
{
If (FoF is file)
You found a file;
Else if (FoF is directory)
Findfile (FoF );
}
}



35. To use foreach to traverse the accessed object, you need to implement the ____________ interface or the type of the declared ________________ method.
A: ienumerable and getenumerator.



36. What is GC? Why does GC exist?
A: GC is a garbage collector. Programmers do not have to worry about memory management, because the Garbage Collector will automatically manage. To request garbage collection, you can call one of the following methods:
System. GC ()
Runtime. getruntime (). GC ()



37. String S = new string ("XYZ"); how many string objects are created?
A: There are two objects, one being "xyx" and the other being the reference object s pointing to "xyx.



38. What is the difference between abstract class and interface?
A:
The class that declares the existence of a method without implementing it is called abstract class. It is used to create a class that reflects some basic behaviors and declare a method for this class, however, this class cannot be implemented in this class. You cannot create an abstract instance. However, you can create a variable whose type is a image class and point it to an instance of a specific subclass. There cannot be a pumping constructor or a pumping static method. The subclasses of abstract classes provide implementation for all the image extraction methods in their parent classes. Otherwise, they are also called image classes. Instead, implement this method in the subclass. Other classes that know their behavior can implement these methods in the class.
An interface is a variant of the image class. In the interface, all methods are extracted. Multi-inheritance can be achieved by implementing such an interface. All methods in the interface are drawn, and none of them has a program body. The interface can only define static final member variables. The implementation of an interface is similar to that of a subclass, except that the implementation class cannot inherit behaviors from the interface definition. When a class implements a special interface, it defines (to be given by the program body) all the methods of this interface. Then, it can call the interface method on any object of the class that implements this interface. Because of the image class, it allows the interface name to be used as the type of the referenced variable. Normally, dynamic Association editing will take effect. The reference can be converted to the interface type or from the interface type. The instanceof operator can be used to determine whether the class of an object implements the interface.



39. Do I use run () or start () to start a thread ()?
A: To start a thread is to call the START () method so that the virtual processor represented by the thread is runable, which means it can be scheduled and executed by JVM. This does not mean that the thread will run immediately. The run () method can generate the exit sign to stop a thread.



40. Can an interface inherit the interface? Can the image extraction class implement the (implements) interface? Can the image class inherit the concrete class )?
A: The interface can inherit the interface. The image extraction class can implement the implements interface to determine whether the image extraction class can inherit the object class, provided that the object class must have a clear constructor.



41. Can constructor be overwritten?
A: constructor cannot be inherited, so overriding cannot be overwritten, but overloading can be overloaded.



42. Can I inherit the string class?
A: The string class is a final class, so it cannot be inherited.



44. The two pairs have the same image value (X. Equals (y) = true), but different hash codes are available, right?
A: No. It has the same hash code.



45. Does swtich work on byte, long, and string?
A: In switch (expr1), expr1 is an integer, character, or string. Therefore, expr1 can be applied to byte and long, or string.



47. After a thread enters a synchronized method of an object, can other threads access other methods of this object?
No. One Synchronized Method of an object can only be accessed by one thread.



48. can abstract methods be both static, native, and synchronized?
A: No.



49. Does list, set, and map inherit from the collection interface?
A: List, set is map, not



50. The elements in the set cannot be repeated. How can we identify whether the elements are repeated or not? Is = or equals () used ()? What are their differences?
A: The elements in the set cannot be repeated. Use the iterator () method to identify whether the elements are repeated or not. Equals () is used to determine whether two sets are equal.
The equals () and = Methods Determine whether the reference value points to the same pair like equals () is overwritten in the class, in order to return the true value when the content and type of the two separated objects match.



51. Does the array have the length () method? Does string have the length () method?
A: neither the array nor the string has the length () method, but only the Length attribute.



52. What is the difference between sleep () and wait?
A: The sleep () method suspends the current thread for a specified time.
Wait () releases the lock on the object and blocks the current thread until it acquires the lock again.



53. Short S1 = 1; S1 = S1 + 1; what is the error? Short S1 = 1; S1 + = 1; what is the error?
Answer: There is a mistake in short S1 = 1; S1 = S1 + 1; S1 is short type, S1 + 1 is int type, and cannot be explicitly converted to short type. It can be changed to S1 = (short) (S1 + 1 ). Short S1 = 1; S1 + = 1 is correct.



54. Let's talk about the differences between final, finally and finalize.
A:
Final-modifier (keyword) If a class is declared as final, it means that it cannot generate a new subclass and cannot be inherited as a parent class. Therefore, a class cannot be declared both abstract and final. Declare variables or methods as final to ensure that they are not changed during use. Variables declared as final must be declared with an initial value, which can only be read and cannot be modified in future references. Methods declared as final can only be used and cannot be reloaded.
Finally-The Finally block is provided for troubleshooting. If an exception is thrown, the matched catch clause is executed, and the control enters the Finally block (if any ).
Finalize-method name. Java technology allows the use of the finalize () method to perform necessary cleanup before the Garbage Collector clears the image from the memory. This method is called by the garbage collector when it determines that this object is not referenced. It is defined in the object class, so all classes inherit it. Subclass overwrites the finalize () method to sort system resources or perform other cleanup tasks. The finalize () method is called before the Garbage Collector deletes an object.



55. How to handle hundreds of thousands of concurrent data records?
A: use stored procedures or transactions. When getting the maximum ID, update it at the same time. Note that the primary key does not have duplicate primary keys when it is not in auto increment mode. A stored procedure is required to obtain the maximum ID.



56. What are the major bugs in session? What methods does Microsoft propose to solve them?
A: The session is lost when the system is busy due to the process recycle mechanism in IIS. You can use sate server or SQL Server database to store the session. However, this method is slow, the end event of the session cannot be captured.



57. What is the difference between a process and a thread?
A: A process is the unit of resource allocation and scheduling by the system. A thread is the unit of CPU scheduling and scheduling. A process can have multiple threads which share the resources of the process.



58. What is the difference between stack and stack?
A: Stack is the memory space allocated during compilation. Therefore, you must define the size of the stack in your code. Stack is the memory space dynamically allocated during program running, you can determine the heap memory size to be allocated based on the program running status.



59. What is the role of adding static before member variables and member functions?
A: They are called common member variables and common member functions, also known as class member variables and class member functions. They are used to reflect the status of the class respectively. For example, a class member variable can be used to count the number of class instances. class member functions are responsible for such statistical actions.



60. asp. Net compared with ASP, what are the main advances?
A: ASP interpretation, aspx compilation, and performance improvement can be separated from the work of the artist, which is more conducive to team development.



61. generate an int array with a length of 100 and insert 1-100 randomly into it, which cannot be repeated.
Int [] intarr = new int [100];
Arraylist mylist = new arraylist ();
Random RND = new random ();
While (mylist. Count <100)
{
Int num = RND. Next (1,101 );
If (! Mylist. Contains (Num ))
Mylist. Add (Num );
}
For (INT I = 0; I <100; I ++)
Intarr [I] = (INT) mylist [I];



62. Please describe several common methods for passing parameters between pages in. NET and describe their advantages and disadvantages.
A: Session (viewstate) is simple but easy to lose.
Application global
Cookies are simple but may not be supported and may be forged.
Input tType = "hidden" is simple and may be forged
The URL parameter is simple and displayed in the address bar with a limited length.
The database is stable and secure, but its performance is relatively weak.



63. What does GAC mean?
A: Global Assembly cache.



64. How many requests can be sent to the server?
A: Get and post. Get is generally the link mode, and post is generally the button mode.



65. What is the difference between datareader and dataset?
A: One is a read-only cursor and the other is a table in memory.



66. How many stages are there in the software development process? What is the role of each stage?
Answer: requirement analysis, architecture design, code writing, QA, and deployment



67. What are the meanings of using and new keywords in C? Using command and statement new create instance new hide methods in the base class.
A: Using introduces namespaces or uses unmanaged resources.
New create an instance or hide the parent class Method



68. to process a string, remove the spaces at the beginning and end of the string. If there are consecutive spaces in the string, only one space is reserved, that is, multiple spaces are allowed in the string, however, the number of consecutive spaces cannot exceed one.
A: String inputstr = "xx ";
Inputstr = RegEx. Replace (inputstr. Trim (),"*","");



69. What is the output of the following code? Why?
Int I = 5;
Int J = 5;
If (object. referenceequals (I, j ))
Console. writeline ("Equal ");
Else
Console. writeline ("not equal ");
A: They are not equal, because they compare objects.



70. What is SQL injection and how to prevent it? For example.
A: Use the SQL language vulnerability to obtain a valid identity to log on to the system. For example, the identity verification program is designed as follows:
Sqlcommand COM = new sqlcommand ("select * from users where username = '" + t_name.text + "' and Pwd = '" + t_pwd.text + "'");
Object OBJ = com. excutescale ();
If (OBJ! = NULL)
{
// Pass Verification
}
This code is vulnerable to SQL injection. If you enter 1 'and 1 = '1 in t_pwd in t_name, you can enter the system.



71. What is reflection?
A: Dynamically Retrieve assembly information



72. How to Write Design Patterns with Singleton
A: In the static property, the new constructor is private.



73. What is application pool?
A: Web applications, similar to thread pools, improve concurrency performance.



74. What is a virtual function? What is a pumping function?
A: virtual functions: functions that can be inherited and rewritten by sub-classes. Image pulling function: specifies the functions that must be implemented by non-virtual subclass and must be overwritten.



75. What is XML?
A: The markup language can be expanded using XML. Extensible Markup Language. Tag refers to the information symbols that computers can understand. With this tag, computers can process various types of information.Article. To define these tags, you can select an international markup language, such as HTML, or use a markup language that is freely determined by people like XML. This is the scalability of the language. XML is simplified and modified from SGML. It mainly uses XML, XSL, and XPath.



77. What is a user control in Asp.net?
A: The user control is generally used when the content is mostly static, or a little changes... it is relatively large... similar to include... in ASP, but the function is much more powerful.



78. List the XML technologies you know and their applications.
A: XML is used for configuration. It is used to save static data types. Web Services... And config are the most exposed to XML.



What are common objects in 79.ado.net? Describe them separately.
Answer: Connection database connection Image
Command database commands
Datareader data reader
Dataset



80. What is code-behind technology.
Answer: aspx, resx, and CS files are separated by code. HTML code and server code are separated to facilitate code compilation and arrangement.



81. What is soap and what applications are there.
A: Simple Object Access Protocol (SOAP) is a protocol used to exchange information and execute remote process calls in a distributed or distributed environment. It is an XML-based protocol. When using soap, you do not need to consider any specific transmission protocol (the most commonly used HTTP protocol). You can allow any type of objects or code to communicate with each other in any language on any platform. This type of communication uses messages in XML format.



Soap, also known as xmlp, provides a standard working mechanism for two programs to exchange information. It is absolutely necessary to develop standards for the electronic collaboration between various institutions.



Soap describes how to bind a message to XML. It also describes the sender of the sent message, the content and address of the message, and the time when the message was sent. Soap is the basic communication protocol for Web Services. The SOAP specification also defines how to use XML to describe program data and how to execute RPC (Remote Procedure Call ). Most soap solutions support RPC-style applications. Soap also supports document-style applications (soap messages only contain XML text information ).



Finally, the SOAP specification defines how HTTP messages transmit soap messages. MSMQ, SMTP, and TCP/IP can all be used as soap transmission protocols.



Soap is a lightweight protocol used to exchange structured information in a distributed and distributed environment. Soap uses XML technology to define an extensible message processing framework. It provides a message structure that can be exchanged through multiple underlying protocols. The design idea of this framework is to be independent from any specific programming model and the semantics of other specific implementations.



Soap defines a method to transmit XML messages from point A to point B. To this end, it provides a Message Processing Framework Based on XML and has the following features: 1) scalable, 2) can be used through a variety of underlying network protocols, 3) independent of programming models.



82. C # What are the differences between property and attribute? What are the advantages of this mechanism?
A: attributes are used to access fields of a class, and features are used to identify additional properties of a class or method.



83. Main differences between XML and HTML
Answer: 1. XML is case-sensitive and HTML is not.
2. In HTML, if the context clearly shows where the paragraph or list key ends, you can omit the ending mark such as </P> or </LI>. In XML, the end mark cannot be omitted.
3. In XML, an element with a single tag but no matching ending tag must end with one/character. In this way, the analyzer does not need to find the end mark.
4. in XML, attribute values must be placed in quotation marks. Quotation marks are usable in HTML.
5. In HTML, You can have attribute names without values. In XML, all attributes must have corresponding values.



What is the ternary operator in 84. C?
A :? :.



85. When integer a is assigned to an object, integer A will be?
Answer: packing.



86. Which of the following types of Class Members are accessible?
A: This.; new class (). method;



87. Public static const int A = 1; is there an error in this code? What is it?
A: The const cannot be modified using static.



88. Float F =-123.567f; int I = (INT) F; what is the I value now _____?
A:-123.



89. What is the keyword of the delegate statement ______?
A: Delegate.



91. All Custom User Controls in Asp.net must inherit from ________?
A: control.



92. In. net, all serializable classes are marked _____?
A: [serializable]



93. In. Net hosting code, we don't have to worry about memory vulnerabilities. This is because ______?
A: GC.



94. Are there any errors in the following code? _______
Using system;
Class
{
Public Virtual void F (){
Console. writeline ("a.f ");
}
}
Abstract class B:
{
Public abstract override void F (); A: Abstract override cannot be modified together.
} // New public abstract void F ();



95. when class t only declares the constructor of a private instance, ___ can ___ (can or cannot) derive a new class from T outside the program text of T, it is not allowed to create any instance of t directly (either or not.
A: No. No.



96. Is there an error in the following code?
Switch (I ){
Case (): A: // The case () condition cannot be blank.
Casezero ();
Break;
Case 1:
Caseone ();
Break;
Case 2:
Dufault; A: // wrong. The format is incorrect.
Casetwo ();
Break;
}



97. Can system. Web. UI. Page be inherited in. Net?
A: Yes.



What is the error handling mechanism of 98..net?
A: the. NET error handling mechanism adopts the try-> catch-> finally structure. When an error occurs, it is thrown layer by layer until a matched catch is found.



99. The operator statement is used and only = is declared. Is there any error?
A: Do you want to modify equale and gethash () at the same time ()? If "=" is reloaded, it must be reloaded "! ="



104. A password only uses five letters (K, L, M, N, and O). The words in the password are arranged from left to right. The password words must follow the following rules:
(1) the minimum length of a password word is two letters, which can be the same or different.
(2) K cannot be the first letter of a word.
(3) If l appears, more than once
(4) M cannot make the last or second-to-last letter
(5) If K appears, N must appear.
(6) If O is the last letter, l must appear
Question 1: Which of the following letters can be placed behind o in Lo to form a three-letter password word?
A) k B) L C) m d) N
Answer: B



Question 2: If the letters K, L, and m can be obtained, what is the total number of two letter-length password words?
A) 1 B) 3 C) 6 d) 9
Answer:



Question 3: Which of the following is the word password?
A) klln B) loml c) mllo d) nmko
Answer: c



8. 62-63 = 1 the equation is not true. Please move a number (do not move the minus sign or equal sign) so that the equation is true. How do you move it?
Answer: 62 is moved to the power 6 of 2.



105. For such an enumeration type:
Enum color: byte
{
Red,
Green,
Blue,
Orange
}
A: String [] Ss = enum. getnames (typeof (color ));
Byte [] BB = enum. getvalues (typeof (color ));



In 106. C #, what are the differences between property and attribute? What are the advantages of this mechanism?
A: attribute: The base class of the custom attribute. property: the attribute in the class.



107. C # Can I perform direct operations on the memory?
A: In.. net ,. net references the garbage collection (GC) function, which replaces programmers. However, in C #, the Finalize method cannot be directly implemented, but the finalize () method of the base class is called in the destructor.



108. Ado. What are the main improvements to net over ado?
A: 1. ado.net does not rely on the ole db provider, but uses it.. Net-managed programs. 2: Do not use com3: do not support dynamic cursors and server-side games. 4: You can disconnect the connection and retain the current dataset. 5: strong type conversion. 6: XML support.



109. Write an HTML page to implement the following functions: "Hello" is displayed when you click the page with the left-click button, and "disabled right-click" is displayed when you right-click the page ". The page is automatically closed in 2 minutes.
A: <SCRIPT *** SCRIPT>
SetTimeout ('window. Close (); ', 3000 );
Function show ()
{
If (window. event. Button = 1)
{
Alert ("Left ");
}
Else if (window. event. Button = 2)
{
Alert ("right ");
}
}
</SCRIPT>



110. Briefly describe ASP. NET Server Control Lifecycle
Answer: Initialize loading view status processing sending and returning data loading sending and returning change notification processing sending and returning event pre-rendering save status rendering processing and uninstalling



111. Can anonymous inner class (anonymous internal class) be extends (inherited) other classes, or implements (implemented) interface (Interface )?
A: No. The interface can be implemented.



112. Differences between static nested class and inner class: the more you say, the better.
A: static nested class is an internal class declared as static. It can be instantiated without relying on external class instances. In general, internal classes must be instantiated before they can be instantiated.



113., & and.
& Is a bitwise operator that represents bitwise and operation, & is a logical operator that represents logic and (and ).



114. Differences between hashmap and hashtable.
A: hashmap is a lightweight Implementation of hashtable (non-thread-safe implementation). They have completed the map interface. The main difference is that hashmap allows null key values ), because of non-thread security, the efficiency may be higher than that of hashtable.



115. Short S1 = 1; S1 = S1 + 1; what is the error? Short S1 = 1; S1 + = 1; what is the error?
Answer: Short S1 = 1; S1 = S1 + 1; (the S1 + 1 operation results in int type, which requires forced conversion)
Short S1 = 1; S1 + = 1; (it can be compiled correctly)



116. Can the overloaded method change the type of the returned value?
A: The overloaded method can change the type of the returned value.



117. What is the difference between error and exception?
A: Error indicates that the restoration is not an impossible but difficult case. For example, memory overflow. It is impossible to expect the program to handle such a situation.
Exception indicates a design or implementation problem. That is to say, it indicates that if the program runs normally, it will never happen.



118. What are the differences between <% # %> and <%>?
A: <% # %> indicates the bound data source.
<%> Is a server-side code block.



119. What is the biggest difference between ASP. NET 2.0 (vs2005) and the development tool you used earlier (. NET 1.0 or other? Which development ideas (pattern/architecture) you used on previous platforms can be transplanted to ASP. NET 2.0 (or are already embedded in ASP. NET 2.0)
Answer: 1 ASP. NET 2.0 encapsulates and packages some code, so it reduces a lot of code compared to the same function of 1.0.
2. Both the code separation and page embedding server-side code modes are supported. In the previous version 1.0 ,.. Net prompt help is only available in separated code files. You cannot embed server-side code on the page to get help tips,
3. When switching code and design interfaces, 2.0 supports cursor positioning.
4. When binding data, you can perform operations such as paging, update, and delete on tables in a visualized manner, facilitating beginners.
5. More than 40 new controls are added to ASP. NET, reducing the workload.



120. What is the difference between heavy load and coverage?
Answer: 1. The method overwrites the relationship between the Child class and the parent class. The method overload is the relationship between the methods in the same class and the horizontal relationship.
2. Override can only be composed of one method, or can only be composed of one method. Method Overloading is the relationship between multiple methods.
3. The overwrite request parameter list is the same; the reload request parameter list is different.
4. In the override relationship, the method body called is determined based on the object type (corresponding to the bucket type of the object); the reload relationship, the method body is selected based on the real parameter table and the form parameter table during the call.



121. To describe the implementation process of the indexer in C #, can I index data only by numbers?
A: No. Any type can be used.



125. Analyze the following code.
Public static void test (string connectstring)



{



System. Data. oledb. oledbconnection conn = new system. Data. oledb. oledbconnection ();
Conn. connectionstring = connectstring;
Try



{
Conn. open ();
.......
}
Catch (exception ex)
{
MessageBox. Show (ex. tostring ());
}
Finally
{



If (! Conn. state. Equals (connectionstate. Closed ))
Conn. Close ();
}
}
Excuse me



1) Can the above Code correctly use the connection pool?



Answer: If the input connectionstring is the same, you can use the connection pool correctly. But exactly the same means that the numbers of spaces in the hyphen are in the same order.



126. the company requires the development of an inherited system. windows. forms. listview components require the following special features: When you click the headers of columns in the listview, all rows in the view can be rearranged based on the values of each row in the click column (the sorting method is similar to that in the DataGrid ). Based on your knowledge, please briefly discuss your ideas:
A: Based on the column header clicked, the ID of this column is taken out, sorted by the ID, and bound to the listview



127. What is WSE? What is the latest version?
A: The WSE (Web Service Extension) package provides the latest web service security assurance. The latest version is 2.0.



128. In the following example
Using system;
Class
{
Public (){
Printfields ();
}
Public Virtual void printfields (){}
}
Class B:
{
Int x = 1;
Int y;
Public B (){
Y =-1;
}
Public override void printfields (){
Console. writeline ("x = {0}, y = {1}", x, y );
}
What is the output when new B () is used to create B's instance?
Answer: x = 1, y = 0



129. In the following example



Using system;
Class
{
Public static int X;
Static (){
X = B .y + 1;
}
}
Class B
{
Public static int y = a.x + 1;
Static B (){}
Static void main (){
Console. writeline ("x = {0}, y = {1}", a.x, B .y );
}
}
What is the output result?
Answer: x = 1, y = 2



130. What is the difference between abstract class and interface?
A: The class that declares the existence of a method without implementing it is called abstract class. It is used to create a class that reflects some basic behaviors and declare a method for this class, however, this class cannot be implemented in this class. You cannot create an abstract instance. However, you can create a variable whose type is a image class and point it to an instance of a specific subclass. There cannot be a pumping constructor or a pumping static method. The subclasses of abstract classes provide implementation for all the image extraction methods in their parent classes. Otherwise, they are also called image classes. Instead, implement this method in the subclass. Other classes that know their behavior can implement these methods in the class.
An interface is a variant of the image class. In the interface, all methods are extracted. Multi-inheritance can be achieved by implementing such an interface. All methods in the interface are drawn, and none of them has a program body. The interface can only define static final member variables. The implementation of an interface is similar to that of a subclass, except that the implementation class cannot inherit behaviors from the interface definition. When a class implements a special interface, it defines (to be given by the program body) all the methods of this interface. Then, it can call the interface method on any object of the class that implements this interface. Because of the image class, it allows the interface name to be used as the type of the referenced variable. Normally, dynamic Association editing will take effect. The reference can be converted to the interface type or from the interface type. The instanceof operator can be used to determine whether the class of an object implements the interface.





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.