如何从.dll中提取结构类型名称?

时间:2010-09-01 10:42:04

标签: reflection c#-3.0

我们可以使用System.Reflection从.dll中提取结构的名称吗? 请提供一些链接。

struct MyStruct // <-- this name i wanna to find from .dll using Reflection
{
    private int length;
    private int breadth;
    public int Area(int length,int breadth)
    {
        return length*breadth;
    }
}

2 个答案:

答案 0 :(得分:4)

您可以通过调用Assembly.GetTypes()方法从程序集( .dll )中获取所有类型的列表。可以从Type.Name属性访问每种类型的名称。

答案 1 :(得分:2)