Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the basics of .net

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article introduces the relevant knowledge of "what are the basics of .net". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Three characteristics of object-oriented

Encapsulation, inheritance, polymorphism

two。 Packing and unpacking

Boxing: converting value types to reference types

Unboxing: converting reference types to value types

In .NET, data types are divided into value types and reference types (which are not equivalent to C++ pointers). Accordingly, memory allocation is divided into two ways, one is stack, the other is heap, note: it is managed heap.

Value types are only assigned in the stack.

The reference type allocates memory and managed heap.

The managed heap corresponds to garbage collection.

Can 3.C# operate directly on memory?

Yes, by adding a unsafe keyword.

The difference between structure and Class in 4.C#

Institutions and classes have a general syntax, and structures are subject to more restrictions than classes. Structure cannot declare a constructor. The structure is the value type and the class is the reference type. Structure can be instantiated without using the new keyword. Classes can implement interfaces, but structures cannot.

5. Can the interface inherit the interface? Can abstract classes implement interfaces? Can abstract classes inherit entity classes?

(1) an interface can inherit an interface

(2) Abstract classes can implement interfaces.

(3) Abstract classes can inherit entity classes, but there is a condition that entity classes must have explicit constructors.

6. Can the constructor Constructor be inherited? Can it be rewritten (Override)?

Constructors cannot be inherited and therefore cannot be overridden, but can be overloaded (overload).

The difference between 7.Error and Exception

Error says recovery is a serious problem in situations that are not impossible but difficult. For example, memory overflow. It is impossible to expect a program to handle such a situation; exception represents a design or implementation problem. That is, it means that if the program works properly, it will never happen.

8. Tell me about your understanding of delegation in C#

A delegate is a class that defines the type of a method so that it can be passed as a parameter of another method. This practice of dynamically assigning a method to a parameter can avoid the extensive use of If-Else (Switch) statements in the program and make the program more extensible. An event is a message mechanism and a delegate without a method body.

9. Brief introduction of reflection and serialization

Reflection: in fact, it is the dynamic operation of the assembly, the assembly includes the module, and the module contains the type, and the type contains the member. Reflection provides objects that encapsulate assemblies, modules, and types.

We can use reflection to dynamically create an instance of the type, bind the type to an existing object, or get the type from the existing object, and then call the method of the type or access fields and properties.

Serialization: simply understood as the process of converting an object into a format that is easy to transfer. For example, you can serialize an object and then use HTTP to transfer the object between the client and the server over Internet.

At the other end, you can use deserialization to reconstruct the object from the stream.

The difference between value type and reference type in 10.C#

(1) the data of the value type is stored in the stack of memory; the data of the reference type is stored in the heap of memory, and the memory unit stores only the address of the object in the heap.

(2) the access speed of value type is fast, while that of reference type is slow.

(3) the value type represents the actual data, and the reference type represents a pointer or reference to the data stored in the memory heap

(4) the value type inherits from System.ValueType and the reference type inherits from System.Object

(5) the memory allocation of the stack is automatically freed, while the heap will be freed by GC in .NET.

(6) the variables of the value type directly store the actual data, while the variables of the reference type store the address of the data, that is, the reference of the object.

Welcome to add.

11. Talk about your understanding of the three-tier structure.

(1) DAL: data access layer, which directly adds, deletes, modifies and queries the database.

(2) BLL: business logic layer, the processing of data services.

(3) UI: presentation layer, showing the processed data to the user.

Advantages: reflect the idea of object-oriented programming: high cohesion and low coupling, improve scalability.

12. What classes are used by ado.net?

SqlConnection 、 SqlDataAdaptor 、 DataSet 、 SqlCommand 、 SqlDataReader

13.SQL statement to achieve paging: query 31-40 records in Table T (with self-increasing sub-segment ID)

Select * from (select ROW_NUMBER () over (order by ID) as rowNum,* from T) as t where rowNum between 31 and 40

This is the end of "what are the basics of .net"? thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report