C#.net frequently confused knowledge points

Source: Internet
Author: User
Tags null null wsdl
1, please tell me. What are the differences between classes and structs in net?
A: Structs and classes have a general syntax, but structs are more restrictive than classes. Structs cannot declare a default constructor, and a copy of the structure is created and destroyed by the compiler, so the default constructors and destructors are not required. A struct is a value type, so a change to a struct variable does not affect its original value, and the class is the application type, and changing the value of its variable changes its original value. The declaration structure uses the struck keyword, declaring the class with the class keyword, passing a struct to a method when it is passed by value, not by reference. Unlike classes, structs can be instantiated without the use of the new keyword. class can implement interfaces.
2, what are the necessary conditions for deadlocks? How to overcome?
A: The system's resources are insufficient, the process of advancing the order is inappropriate, the resource allocation is not appropriate, a resource can only be used by a process at a time, a resource request resources, and at this time this resource has been blocked, to have access to resources, process access to resources, not used until the end, can not be forcibly deprived.
3, can interfaces inherit interfaces? Can an abstract class implement an interface? Can abstract classes inherit entity classes?
A: An interface can inherit an interface, an abstract class can implement an interface, an abstract class can inherit an entity class, but there is a condition that the entity class must have a definite constructor.
4, can the constructor constructor be inherited? Is it possible to override?
A: constructor can not be inherited and therefore cannot be rewritten (overriding), but can be overloaded (overloading).
5, can I inherit the String class?
A: Because the String class is the final class, you cannot inherit the string class.
5, when a thread enters the method of an object, does the other thread have access to the object's method?
A: No, the method of an object can only be accessed by one thread.
6, the most effective method to calculate the number of 8 for a few?
Answer: 2<<3.
Can 7,c# operate directly on memory?
Answer: This question is more difficult to answer, but also a big problem. But you can ask questions like this. C # is the ability to directly manipulate memory, although very few pointers, but C # can use pointers, in the use of the need to add unsafe, in. NET using the garbage collection mechanism (GC) feature, which replaces the programmer, but in C # can not directly use the Finalize method , but instead calls the Finalize () method of the base class in the destructor.
7, does the array have length () This and method? Does string have this method?
A: There is no such method in the array, but there is this property, which is the method in string.
8, is there a difference between error and exception?
A: Error means recovery is not impossible, but it is difficult, exception represents an actual or implementation problem, it indicates that the program does not work properly can not happen.
9, talk about the difference between final,finally,finallize?
A: Final is used to declare properties, methods, and classes that represent properties that are immutable, that methods cannot be overwritten, and that classes cannot be inherited.
Finally is the exception-handling statement structure that represents the part that is always executed.
Finallize represents a method of the object class that is invoked when it is executed in the garbage collection mechanism.
The difference between 10,hashmap and Hashtable?
A: HashMap is a lightweight implementation of Hashtable, non-thread-safe implementation They all implement the map interface, the main difference is that the HashMap key value can be null NULL, efficiency can be higher than Hashtable.
The difference between 11,collection and collections?
A: Collection is the superior interface of * * * * class, Collections is a helper class for * * * * class, it provides a series of static methods to achieve the search, sorting, thread-safe operation of various * * * * *.
What is a delegate in 12,c#? Is the event a delegate?
A: A delegate is a secure similar to a function pointer, but she is much more secure than a pointer, and it can pass a method as a parameter to another method, which can be understood as a reference to a function. An event is a message mechanism, which is a delegate that delegates without a method body.
13,override, overload, the difference?
A: Override is the overriding meaning, which represents the method of overriding the base class, and the name of the method, the return type, the parameter type, and the same number of arguments as the base class.
Overload is the meaning of overloading, and it also represents the method of overriding the base class, but the other can be different as long as the method name is the same.
14, when you need to pass variable values in a BS structure, you can't use Session,coolke,application, how many methods do you have?
Answer: This.server.transfer,querystring.
15,c# the implementation process of the indexer, is it only based on the numeric index?
Answer: No, it can be any type.
15,c# the implementation process of the indexer, is it only based on the numeric index?
Answer: No, it can be any type.
16,new have a kind of usage?
A: There are 3 kinds, the first is, instantiate as: New Class ()
The second is that public new hides the base class method
The third is that any type parameter in a generic class declaration must have a public parameterless constructor.
17, any copy of an array to ArrayList?
Answer: Foreach (object o in Array), Arraylist.add (0)
There are many kinds of methods. Think of yourself.
18, overview of reflection and serialization?
A: Reflection: To give the launch of the next definition is more difficult, here first to say my understanding. Reflection provides encapsulating assemblies, modules, and type objects, which can be used to dynamically create instances of types, bind types to existing objects, or get types from existing object types, and then invoke methods of types or access fields and properties.
Serialization: The process of converting an object into a format transmitted by another medium. For example, serializing an object, passing the object between the client and the server over the Internet with HTTP, and re-obtaining the object from the stream at the other end with deserialization.
19,const and readonly?
A: const is used to declare constants when programming, and ReadOnly is used to declare a running constant.
What are the similarities and differences between 20,UDP and TCP connections?
A: TCP is a Transmission Control protocol that provides connection-oriented, reliable, byte-stream services that, when users and servers interact with each other, must make a TCP connection before they can transfer data. TCP provides time-out redial to verify the data function. UDP is a User Datagram protocol, is a simple datagram-oriented transport protocol, is unreliable connection.
21, how do processes and threads understand each other?
A: The process is larger than the thread of the program to run the unit, is the operating system realized by the operation of the unit, a program must have at least one process, there is a process, at least one thread, the thread partition scale is smaller than the process, the process has a separate memory unit, the thread is shared memory, This greatly improves the running efficiency of the program. Multiple threads in a process can execute concurrently.
22,asp. NET pages to pass values between the several ways?
Answer: Querystring,session,cookies,application,server. Transfer,respose.redictor.
41. What is an application domain? What is managed code? What is a strongly typed system? What are crates and unboxing? What is overloading? What are the CTS, CLS, and CLR explanations for each?
A: Application domain: Is the isolation boundary provided for security, reliability, isolation, and versioning, and uninstallation programs. It is typically created by the runtime host, and the application domain provides a more secure, more versatile processing unit.
Managed code: code written using the CLR compiler language editor is called managed code.
Boxing and unpacking: The process of converting a value type to a reference type is implicit, and the reverse process is unpacking, which is explicit.
The CTS is a public type system, the CLS is the common language specification, and the CLR common language runtime.
Strongly typed systems: Each variable and object must have a declaration type.
41. What is the difference between a value type and a reference type?
A: The value of a value type is stored in the stack, changing its value, does not change the original value of the variable, and the value of the reference type is stored in the stack, the address of the reference is stored in the stack, changing its value will change the value of the original variable. Value types are not allowed to contain null values, however nullable types can assign null to value type L.
42. What are the authentication methods for ASP.
Answer: Windows,forms,passport
43. Explain the meaning and role of UDDI and WSDL.
A: UDDI is a unified description of the integration protocol, a set of Web-based, distributed, implementation standards for information registration for Web services, as well as protocol standards that are also registered for the Web services provided by the enterprise itself to enable other enterprises to discover and access. Provides standards-based specifications for describing and discovering services, and provides a set of Internet-based implementations.
WSDL This is an XML-based interface that describes Web services.
44. What is SOAP?
A: The simple access Protocol. is a protocol that exchanges information and implements remote calls in a distributed environment. is an XML-based protocol. Soap can be used regardless of any transport protocol, but it is usually an HTTP protocol that allows any type of object or code to communicate with each other in any language on any platform. It is a lightweight protocol.
45. How do I deploy an ASP page?
A: There are publishing mechanisms in vs2003,vs2005, vs2003 can be published and then deployed in replication.
VS2005 can be deployed directly to the corresponding location.
46. How do you understand the garbage collection mechanism in. NET?
For:. NET garbage collection mechanism is the reference program to the memory collection and release. Each time an object is created with the new keyword, the runtime allocates memory from the managed heap because the space is limited and the final garbage collection mechanism is to reclaim unused memory. Memory has been freed and reused.
47. The three basic principles of object-oriented?
Answer: encapsulation, inheritance, polymorphism.
48. What is the base class for all classes in. NET?
Answer: Object.
50. The object that can be accessed with foreach traversal needs to be implemented?
A: You need to implement the IEnumerable interface and the GetEnumerator () method.
51. What is the difference between heap and stack?
A: Heap is heaps, space is allocated and freed by manual operations, and it has a large storage area of free storage.
Stack is a stack, which is automatically allocated and released by the operating system, and the space on the stack is limited. During compilation, variables and functions allocate memory on the stack, and the pass-through of parameters at runtime function calls is performed on the stack.
  • 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.