什么是.NET中的元数据? [英] What is metadata in .NET?

查看:219
本文介绍了什么是.NET中的元数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我GOOGLE了几个网站,以了解是.NET和它的意思。

I googled several sites to understand what metadata is in .NET and it means.

我还是新的C#WPF的桌面应用程序。当我还是web编程,有meta标签在HTML code其中我们描述了站点的标题,关键字和这样的。同样是在.NET应用程序相似?我读了维基,并用Google搜索,但我得到的是概念性的解释。

I'm still new to C# WPF desktop application programming. Back when I was web programming, there are meta tag in HTML code where we describe the site with titles, keywords and such. Is also similar in .NET application? I read wiki, and googled but all I get is conceptional explanation.

一个描述元数据是描述了组装和每种类型的详细说明的状态下,在组件中属性。是元数据只是一个概念或我输入的某处来形容我的code物理的东西像codeS线?如果是这样,我的表彰与我的元数据?

One describes "metadata is data that describes the state of the assembly and a detailed description of each type, attribute within the assembly". Is metadata just a concept or something physical like line of codes I typed in somewhere to describe my code? If so, do my commend becomes my metadata?

我读的元数据是在公共语言运行库(CLR),但我code仅在C#中,我怎能code在CLR成元数据?元数据是在CLR一个表彰?我怎样才能改变它。

I read metadata is "Within the Common Language Runtime (CLR)", but I code only in C#, how can I code in CLR into the metadata? Is metadata a commend in CLR? How Can I change it.

MSDN 写道,元数据的二进制信息的另一种语言的软件组件,以了解它。我还以为只有人类需要说明(表彰)用英语理解的code块呢。软件组件简单地执行任何声明,我们写了 - 什么是二进制的信息需要。如何编译理解我的高位code中的意义生成的描述组装?如果我写一个程序,转换成货币,将元数据自动生成的知道程序是转换货币?这是哪里的情报?

MSDN wrote that metadata is binary information for software component of another language to understand it. I though only human needs description (commend) in English to understand what a block of code does. Software component simply executes whatever statement we wrote - what's is the need of the "binary" information. How can the compiler understand the meaning of my high level code to generate "Description of assembly"? If I write a program that convert currency, would the metadata auto-generated knowing the program is converting currency? Where is this intelligence?

我完全糊涂了。

推荐答案

既然别人已经提供了很大的解释答复,我就提你如何看待自己的元数据。

Since others already provided great explanatory answers, I'll just mention how you can view metadata yourself.

在您的Microsoft SDK目录(最有可能变化的 C:\ Program Files文件\微软的SDK \的Windows \ v7.0A \ BIN \ NETFX 4.0工具的)有计划名为程序Ildasm.exe - 这是简单的反汇编器,允许你查看编译.NET二进制文件

In your Microsoft SDK directory (most likely variations of C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools) there's program called ildasm.exe - it's simple disassembler that allows you to view compiled .NET binaries.

您可以建立非常简单的控制台应用程序,并使用程序Ildasm.exe 来查看编译的内容。 查看/元信息/显示的命令(或简称按Ctrl + M 的),将显示的元数据 - !你可以检查他们的样子。元数据部分来自应用程序的打印您好来控制台:

You can build very simple console application and use ildasm.exe to view compiled contents. View/MetaInfo/Show! command (or simply Ctrl + M) will display metadata - you can check how they look like. Part of metadata from application printing Hello to console:

TypeDef #1 (02000002)
-------------------------------------------------------
TypDefName: Program  (02000002)
Flags     : [Public] [AutoLayout] [Class] [AnsiClass] [BeforeFieldInit](00100001)
Extends   : 01000001 [TypeRef] System.Object
Method #1 (06000001) [ENTRYPOINT]
-------------------------------------------------------
    MethodName: Main (06000001)
    Flags     : [Public] [Static] [HideBySig] [ReuseSlot]  (00000096)
    RVA       : 0x00002050
    ImplFlags : [IL] [Managed]  (00000000)
    CallCnvntn: [DEFAULT]
    ReturnType: Void
    1 Arguments
        Argument #1:  SZArray String
    1 Parameters
        (1) ParamToken : (08000001) Name : args flags: [none] (00000000)

在这里你可以看到类型定义(计划)和它的方法(),这需要单输入参数,并返回void。这自然是元数据的一部分,甚至是simpliest节目有很多了。

Here you can see type definition (Program) and one of its methods (Main), which takes single input argument and returns void. This is naturally only part of metadata, even for simpliest programs there's a lot more.

这篇关于什么是.NET中的元数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆