Interview arrangement: C # (i)

Source: Internet
Author: User

The series continues to update, from the online and around the collection of questions

1. What kinds of accessibility levels are available

Public access is not restricted.
Protected access is limited to types that contain or derive from the containing class.
Internal access is limited to the current assembly.
Protected internal access is limited to the current assembly or type derived from the containing class.
Private access is limited to the containing type.

The difference between 2.String and StringBuilder

The string class has an immutable nature. Each time a character operation is performed, a new string object is created.
The StringBuilder object has only one object after initialization.
Use StringBuilder better when you are frequently manipulating or stitching strings

*string is a reference type, stored on the heap

The difference between 3.Struct and class

Class is a reference type, structs is a value type
Class is created on the heap. struct created on the stack
Class can have initializers, structs can not have initializers
Class can have a distinct parameterless constructor, but structs cannot
class must be instantiated before it is used, and the struct does not need
Class supports inheritance and polymorphism, struct does not support
The constructor of class does not need to initialize all fields, and the constructor of the struct must initialize all fields
Class has an object-oriented scaling advantage, and struct has performance benefits

4. application domain? Managed code? Strong type System? Packing and unpacking? Overload?

application domain (AppDomain)

Can be seen as a lightweight process, a process can contain multiple application domains, an application domain can mount an executable program (*.exe) or multiple assemblies (*.dll). This enables deep isolation between application domains, even if an error occurs in an application domain in the process, and does not affect the normal operation of other application domains

Managed codes (Managed code)

Intermediate language (IL) code, which is executed by the common language runtime (CLR), instead of directly by the operating system, is interpreted by the CLR to computer language

Strongly typed systems

All variables must be of the specified type, and no two different types of variables are allowed to interoperate before coercion type conversion

Packing and unpacking

box is to convert a value type to a reference type, and the unboxing is to convert the reference type to a value type

Overload

A method with two or more names in the same class but different parameters

What are the 5.CTS, CLS, and CLR explanations for each?

Http://www.cnblogs.com/zagelover/articles/2741370.html

CTS Common Type Systems (Common type System)

Describes the definition and behavior of a type.

CLS Common Language Specification (Common Language specification)

is a subset of the CTS that defines what you want to write in. NET platform, the minimum specification required for the language of programs running on the

CLR Common language Runtime (Common Language Runtime)

The CLR is the implementation of the CTS, which means that the CLR is the application's execution engine and a fully functional class library, which is implemented in strict accordance with the CTS specification.

What is 6.GC?

CLR garbage collection mechanism that automatically reclaims objects that are not referenced on the heap according to "generation"

To be continue ...

Interview arrangement: C # (i)

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.