C # interview questions

xiaoxiao2021-04-03  234

4

What is the delegation in C #? Is an event?

The delegate is a class that can be referenced by methods. Unlike other classes, the delegate class has a signature, and it can only be referenced to the method that matches its signature. In this way, the commission is equivalent to a type of security function pointer or a callback. The event is a commission.

5, what is the main improvement in ADO.NET relative to ADO?

ADO is stored in Recordset, and ADO.NET is represented by a DataSet. Recordset looks more like a single table, if the Recordset must be used in multiple tables in SQL in a multi-table mode. Conversely, the DataSet can be a collection of multiple tables. ADO's operation is an online way, which means that it must be real-time whether it is browsing or updating data. ADO.NET uses offline mode, ADO.NET uses XML to make data, and ADO.NET's database connection is only available online.

Since ADO uses COM technology, this requires the data type used to comply with the COM specification, and ADO.NET is based on XML format, and the data type is more rich and does not need to do Data type conversion caused by COM arrangement, thereby improving overall performance. .

6. What is the difference between the interface and abstract classes? What is the basis for choosing an interface and an abstract class?

The interface is a pure abstract class, there is no practical thing, just defines a framework, and an abstract class can have a practical method, and all methods are not required to be abstract. You can implement all the methods in an interface, or you can inherit an abstract class and override the method. Interfaces generally only have methods without data members or attributes. Abstract classes have methods, there are also data members or properties, in general, prioritize the interface, only when you might want to access the data member or attribute, with an abstract class.

7. Talk about the difference between FINAL, FINALLY, FINALIZE.

Final modifiers are used to specify classes that cannot be extended or the method or attribute cannot be overwritten. It will prevent other classes from changing the behavior of this class by rewriting important functions. A method with a Final modifier can be hidden or overloaded by methods in derived classes.

Finally blocks are used to clear any resources allocated in the TRY block. Control is always passed to the Finally block, which is independent of the presence of the TRY block.

Finalize allows Object to attempt to release resources before "garbage collection" recycle Object and perform other cleaning operations.

转载请注明原文地址:https://www.9cbs.com/read-131578.html

New Post(0)