Document directory
- About types
- Access Modifier
About types
For. Net types, we can see the value type and reference type in many places on the Internet. I think so too. It seems that there is no error in this regard. However, from an academic point of view, this article tells you where you want to think about it. You just need to have a chat with other colleagues after a meal and just listen to it.
There are two types:
To put it simply:
Value types: The type inherited from system. valuetype.
Generic Type parameters: type with generic parameters, that is, the so-called "Open Type" mentioned by debuglzq in generics. It features that it cannot be instantiated before t is specified. For details, refer to the post above debuglzq: introduction to the basic principles of generic in. net.
Pointer types: pointer type, an unsafe unmanaged type.
Reference types: Other types other than the preceding three types. Note that system. valuetype and all reference types are inherited from the system. Object base class.
We usually talk about. net System. object is a base class of all types. In fact, we can define a class by ourselves and do not inherit from the system. object,. net strongly does not recommend us to do this. If you are interested, you can check the CLR to see the specific implementation. Actually. all existing interfaces, such as ilist, iemumerable, and icollection, are not inherited from system. object, because when you open its Il, you cannot find the extends system. objects are not inherited from any class. Refer to Wang Tao's blog post: [. Net you must know] 27th: Does interface inherit from objects?
Access Modifier
I didn't plan to write this item. Since we have all said the type, I will take the access modifier and write it in a word --!.
Make a table to explain:
C # terminology |
CLR terminology |
Private |
Private |
Protected |
Family |
Not Supported |
Family and assembly |
Internal |
Assembly |
Protected internal |
Family or assembly |
Public |
Public |
I still remember when I interviewed the company, the first question that the vice president of technology talked about was the. NET type and access modifier. At that time, I answered the latter and chatted happily.
Remember to mention that C #5.0 in a nutshell is used to increase the attention of this article. (Without a license, whoever is idle will hurt you ,--!)
There is no high-end technology, so you can bypass and pat your shots...