Overview
Programs that are now developed on the. NET platform are compiled with IL code, resources, assembly manifests, and type metadata. We know that the IL code is the code we write, the resource is the picture file, XML file, and other files, but not clear is the meta-data (in this case the assembly list is metadata), this blog is mainly about the understanding of metadata.
What is meta data?
What is meta data? We look at the concept of Baidu Encyclopedia, meta-data: Describe the data, descriptive information about the data and information resources, read the definition, give me the feeling is that people do not see, do not understand, from this definition I can only say that the Chinese language is too profound, anyway, at the beginning I was not understand, Also see the things of Daniel to understand some, well, say I now understand the metadata.
The program we write eventually compiles the program assembly, and the metadata describes what we have in this assembly, such as what classes are available, what the class's access level is, and so on, and what the members of the class are, and the properties of those members, their types, access levels, and so on. Of course, the relationship between assembly assemblies is also described, and as to why there are these things, this is what metadata does.
the role of meta data
Above we know what the metadata is, this module, what we say is the role of metadata, to understand the role of metadata, we need to know, why we have it, we all know, a new thing, and can quickly rise to the condition that it solves the bad phenomenon at that time, then, What is that bad phenomenon?
When Microsoft did not launch the meta-data technology, one of the problems was that the binary code reuse is very troublesome, then the binary reuse is implemented through COM technology, that is, we write a COM component, and then compile good content for others to use, others can not be used well, why? Because someone else calls the contents of your COM component when it is hard-coded, hard-coded is no smart hint, the calling method does not know if it is a method in a COM component, does not know that it must be run to know, and we know that the method inside the COM component is known through the COM Operations Manual, How inconvenient it was to be.
For the advent of COM technology, is also very strong, why do you think he is bad? Because before it, we can hardly write a library that lets us rest assured, why do we say so? Because before the advent of COM, our program can only call the source code directly, if we write a library, if we want to let others use, then you must give someone else your source code, and then, people who finished the program, the unified generation compiled build, you think, you write things, not how to put the source of all the people, Then someone else is the equivalent of having all.
This is a meta-data generation of a whole process, its main role is to solve the reuse of binary code.
use of meta data
The above mentioned things, I believe you know, the meta-data can be used directly by the VS integrated development environment, and is very common, such as: we add a reference to an assembly, it can be directly and very convenient to use, it is simply the use of assembly metadata for the sake of, then, the metadata is only this? Of course not, the metadata is also can be used by our programmers, its use of one way is reflection, the reflection of the technology is to use metadata to achieve, we can obtain the information of the Assembly through reflection technology, you can get the information of the class and the information inside the class, you can create an object, you can call the method and so on.
In addition to the system to help us generate some metadata, when we are programming, we can also give classes, methods, properties and so on to add some metadata, this is the production of features, features are higher level of abstraction.
Summary
. NET metadata is not its origin, but is borrowed from Java, and many things between. NET and Java are project-referenced; metadata is not a burden for. NET, but rather a higher-level manager.
. NET Metadata