Differences between abstract classes and interfaces |
Abstract class |
Use abstract keywords (abstract class) Can include function definition and implementation Reflects the internal commonalities of things Cannot be instantiated Example: public abstract class withdraw |
Interface |
Use interface keywords Only function definitions can be included Therefore, it reflects the external characteristics of things. Cannot be instantiated Example: public interface withdraw |
Differences between structures and Classes |
Structure |
Yes value type, saved on Stack It is faster to compare the data in a structure to the data in a class or object. Generally, multiple types of data are stored in a structure. When creating a small object shared by many classes or objects, the structure efficiency is higher. |
Class |
Reference type, stored on a controlled Stack |
Differences between abstract and Virtual Methods |
Abstract Method |
Use abstract keywords Methods that must be overwritten by a derived class It can be seen that there is no virtual method to implement the body. It is a virtual method. Example: public abstract bool withdraw (...); |
Virtual Method |
Use virtual keywords Virtual methods can have implementations It can be overwritten in the subclass, or it can be replaced by the default Implementation of the parent class. Example: Public Virtual bool withdraw (...); |
Difference between value type and reference type |
Value Type |
Value-type variables directly store actual data Save the variable value in the stack |
Reference Type |
Variables of the reference type store the data address, that is, the object reference. Store the actual data address in the stack, while the actual data is saved in the heap. |
Difference between heap and stack |
Heap |
Heap is generally used to store variable-length data, such as string type. |
Stack |
Used to store fixed-length data, such as integer data. |
ConstAndReadonlyDifference |
Const |
It can only be initialized in the field declaration. The const field is the number of compile times. By default, const is static. For constants of the reference type, the possible values of const can only be string, value type, and null. |
Readonly |
Can be initialized in declaration or constructor The readonly field may have different values based on the constructors used. Readonly field can be used for running times Readonly must display the declaration if it is set to static. Readonly can be of any type For a readonly reference type, the value assignment (write) operation is not allowed. The read and write operations on its members are still unrestricted. |
Differences between process-oriented and object-oriented |
Process-oriented |
Is the relationship between a predicate and an object. |
Object-oriented |
It is a relationship between the subject and the predicate. Features: encapsulation, inheritance, and Polymorphism |
Differences between classes and objects |
Class |
A class is an abstract and conceptual definition of a certain type of thing. * The focus of object-oriented design is class design. |
Object |
An object, also known as an instance, is an individual that actually exists in such a thing. |
=AndEqueals ()Difference |
= |
Identify whether the essence is equal |
Equeals () |
Identify whether the appearance is equal |
OverrideAndOverloadDifference |
Override |
Indicates rewriting. It is used to inherit the Implementation of Virtual members in the base class. |
Overload |
Indicates the overload, which is used to implement different parameters (including different types or numbers) of methods with the same name in the same class. |
Private,Protected,Public,InternalDifferences between modifier Access Permissions |
Private |
Private Members can be accessed within the class. |
Protected |
Protects members, which can be accessed inside and in the inheritance class |
Public |
Public Member, completely public, with no access restrictions |
Internal |
Accessible within the same namespace |
DatareaderAndDatasetSimilarities and Differences |
Datareader |
Always occupying data connection online operations database any sqlconnection operation will cause datareader exception, because datareader only loads one piece of data in the memory each time, so the occupied memory is very small .. because of the special nature and high performance of datareader. so datareader is only in .. after you read the first entry, you cannot read the first entry. |
Dataset |
The data is loaded into the memory at a time. abandon database connection .. after reading the data, the database connection is abandoned because dataset loads all the data into the memory. therefore, memory consumption is relatively high, but it is more flexible than datareader .. you can dynamically Add rows, columns, and data. perform a back-to-back update operation on the database |
Appplication. ExitAndForm. CloseDifference |
Appplication. Exit |
Exit the entire referenceProgram |
Form. Close |
Disables the specified form. |
Params,Ref,OutDifferences |
Params |
After the Params keyword in the method declaration, no other parameters are allowed, and only one |
Ref |
Parameters that need to be explicitly initialized and passed to the ref parameter must be initialized first .. The property is not a variable and cannot be passed as a ref parameter. |
Out |
You do not need to initialize it as the out parameter to pass the variable. You must assign a value to the out parameter before returning the method. The attribute is not a variable and cannot be passed as the out parameter. |
Finalize ()Difference between dispose () and |
Finalize () |
Used to implicitly release resources, equivalent to the destructor in C ++ |
Dispose () |
Used to display resources released |
What is the difference between an assembly with strong signatures and an assembly without strong signatures? |
Strongly signed assembly |
Can be made into COM and can be installed in GAC |
Assembly without strong Signature |
Com cannot be made and cannot be installed in GAC |
Assembly. loadfrom (), Assembly. LoadFile () Difference |
Assembly. loadfrom () |
It loads the content of the Assembly file. It only loads the file of the input parameters, regardless of the Assembly dependency. However, if the same implementation exists, the files in different locations cannot be loaded with loadfrom at the same time. |
Assembly. LoadFile () |
Because LoadFile loads a file, after calling it, it may be unable to be executed due to the lack of necessary dependencies. If the same implementation is available, however, files in different locations can be loaded with LoadFile at the same time. |
What is the difference between early-binding and late-binding? |
Pre-binding |
Pre-binding determines the data to be bound during compilation. If pre-binding fails, a compilation error will be reported during compilation. |
Post-binding |
Later binding fills in data during running, and later binding fails only during running. |
Differences between XML Web Services Using asmx and. Net remoting using soap |
Web Services |
Message mechanism used by Web Services. Web services can be used on different platforms and languages. |
Remoting |
Remoting uses rpc. remoting is only applicable to. net. Remoting is more efficient than XML Web Service. |
Differences between interface-oriented, object-oriented, and Aspect-Oriented Programming |
Interface-oriented |
APIs are more concerned with concepts. The principle is to define the behavior norms first, and then create and implement them according to the behavior norms. Strictly speaking, interfaces should be part of the object-oriented model, because object-oriented also emphasizes the Dependency inversion principle, that is, implementation depends on abstraction, while abstraction does not depend on specific implementation. What's more, it should be interface-oriented and abstract-oriented, my experience is that the interface is more flexible, but the implementation is a little bitCodeRedundancy, while abstract-oriented can be combined with interface-oriented, first defining interfaces, then defining abstract classes, processing some public logic in abstract classes, and then implementing specific classes. |
Object-oriented |
Object-oriented decomposition of complex problems |
Aspect-Oriented |
Aspect-oriented programming is a new concept that solves many problems that object-oriented cannot solve. For example, object-oriented technology can only modularize business-related code, however, it is impossible to modularize the code unrelated to the business. Aspect-oriented is the solution to this problem. Its key idea is to "separate the business logic in the application from the general service that provides support for it ". |
Differences between threads and processes |
Both threads and processes define some boundary. The difference is that processes define the boundary between applications, different processes cannot share code and data space, while threads define the boundary of code execution stack and execution context. A process can contain several threads and create multiple threads to complete a task at the same time, that is, multithreading. Different threads in the same process share code and data space. In a metaphor, if a family represents a process, each member in the family is a thread, and every member in the family is obligated to accumulate wealth in the family, at the same time, the family has the right to consume family wealth. when facing a task, the family can also send several members to complete the work together, people outside the family cannot directly consume the property of their own families. |
Differences between strong and weak types |
Strong type |
Data of the type is determined during compilation. The type cannot be changed during execution. It is strongly typed and highly efficient and is generally used for compilation.Programming LanguageSuch as C ++, Java, C #, Pascal, etc. |
Weak type |
The weak type determines the type during execution. The weak type is not safe compared to the weak type, and it is prone to errors during operation. However, it is flexible and mostly used in interpreted programming languages, such as JavaScript and VB |
WindowsWhat is the difference between services and standard EXE programs? |
Windows Services |
Windows Service is an application running under the specified user (default system) in the Windows background. It does not have a standard UI interface and is similar to a standard exe program, A Windows service is created at the beginning of the service and destroyed at the end of the service. You can also set whether the service is started with the operating system and disabled together. It supports three methods: 1) automatic mode 2) manual mode 3) disabled. In the automatic mode, the Windows service starts automatically after the OS is started. In the manual mode, the service must be started manually. if disabled, the service cannot be started. windows Services use system users by default. |
Standard exe program |
The standard EXE uses the currently logged-on user by default. |