The difference between override and overloading

Source: Internet
Author: User
Tags abstract error handling exception handling finally block modifier
Difference

1, override and overloading of the difference
Override modifier, overwrite a method in a base class ... Overloading is the ability to write a method that has the same name, and to achieve different functions with the same function. Thus implementing a method with a different version. The essential difference between override and overloading is that you add a override modifier, and this method always has only one method that you use. The difference is like this:
Override It's like
Your name John, your father changed his name to Dick ...
Overload is like
Your name is John, but others can also call John.

2,. NET error handling mechanism is what
Error processing order: Finally, catch second, final fallback try code ... Cancel this operation. Returns the exception information in a catch. Of course, you can also customize your own error handling mechanism ... If you have a finally block in your exception handling, this finally is always executed regardless of whether an exception occurs ...

3, C # interface and class similarities and differences
The difference between an interface and a class is essential. The class is responsible for the implementation of the function, while the interface is the responsible for the definition of the function. The concept of class, Operation class, abstract class can be regulated by implementing interfaces in the project. So as to achieve a high degree of abstraction. You can also call the interface an Non-functional class.

Override is the implementation of an abstract method that is used when a base class cannot provide any meaningful implementation for a method, it is equivalent to say that if a base class is ambiguous about the method body of a method, it can be defined as an abstract method, so inheriting his subclass is forced to implement this method, Otherwise can not be instantiated, this is my personal understanding, the overload needless to say, I understand that they know what the difference is.

4, the similarities and differences between DataReader and dataset
The biggest difference between DataReader and DataSet is that DataReader always occupy the SqlConnection and operate the database online. Any action on SqlConnection throws a DataReader exception. Because DataReader only loads one piece of data in memory at a time, the memory footprint is small. Because of the particularity and high performance of DataReader, so DataReader is only in. You can't read the first one after you read the first one.
A dataset is a one-time load of data in memory. Discard database Connections ... The database connection is discarded when read is complete. Because the dataset loads all the data in memory. So it consumes more memory ... But it's more flexible than DataReader. You can dynamically add rows, columns, and data. Return update operation on database ...

The biggest difference between DataReader and DataSet is that DataReader always occupy the SqlConnection and operate the database online. Any action on SqlConnection throws a DataReader exception. Because DataReader only loads one piece of data in memory at a time, the memory footprint is small. Because of the particularity and high performance of DataReader, so DataReader is only in. You can't read the first one after you read the first one.
A dataset is a one-time load of data in memory. Discard database Connections ... The database connection is discarded when read is complete. Because the dataset loads all the data in memory. So it consumes more memory ... But it's more flexible than DataReader. You can dynamically add rows, columns, and data. Return update operation on database ...




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.