C # Study Notes 2

Source: Internet
Author: User

1. The structure cannot create a constructor without Parameters

2. The structure is generated in the stack, and the class is generated in the heap stack.

3. assign values to each other in the structure. A new structure can be created. The classes assign values to each other, but the references are copied.

4. From the execution efficiency point of view, the stack execution efficiency is higher than that in the heap stack, but in reality, the stack is only suitable for the execution logic.

And heap can execute more complex business logic.

5. The structure cannot derive interfaces like a class.

6. The structure cannot be inherited like a class.

7. The default constructor without parameters is provided in the structure and cannot be replaced. The class also provides constructor without parameters. However

Xu replacement.

8. There is no destructor in the structure, and there is a destructor in the class.

9. keywords such as sealed, abstract, and virtual are not allowed in the structure.

10. The structure cannot be modified using protected.

11. The structure Cannot initialize instance fields.

12. The structure can specify how fields are laid out in the memory. The class is not.

13. Do not try to construct too many methods in the structure. It is best not to define a method unless it is defined.

14. constants must be initialized during declaration.

15. There are two types of constants in c #: Compile-time constant and dynamic constant.

(Runtime constant ).

16. Static constants are defined by the const keyword, and dynamic constants are defined by readonly.

17. const defines that the constant type must be a value type, except string.

18. Dynamic Constants can be defined in Constructor

19. For constants that cannot be declared using const, you can use static readonly to declare

20. The essence of a variable is the memory unit that stores various types of data.

21. is used to determine whether a variable is of a certain type

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.