gpt4 book ai didi

c# - 自动化 .NET Framework 类引用

转载 作者:太空宇宙 更新时间:2023-11-03 20:38:47 24 4
gpt4 key购买 nike

我将不得不生成大量 extern,以便我可以从另一种编程语言为我正在处理的开源项目连接 .NET 框架。我想知道是否有任何方法可以将所有 MSDN 类引用作为 XML 或其他内容获取?我正在考虑解析实际的 HTML,但它似乎不是很直接,所以我想知道是否有更好的方法。

我能从他们那里得到的细节越多越好。因此,例如,如果它适用于 Compact Framework,或者版本差异,那么能够获得它会很棒。

非常感谢!

最佳答案

示例代码(直接写在这个答案中,你要修改它):

//Will load your assembly and all .Net core assemblies.
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
Console.WriteLine("Going through " + assembly.Location);
foreach(var type in assembly.GetTypes())
{
Console.WriteLine("Type " + type.FullName + " has the following methods:");
for (var method in type.GetMethods())
{
// you can create another loop to go through all method arguments.
Console.WriteLine(method.Name);
}
}
}

要遍历所有程序集,只需对 C:\Windows\Microsoft.Net\Assembly\GAC_MSIL 和 Assembly.Load 中的所有子目录使用 Directory.GetFiles() 即可。

关于c# - 自动化 .NET Framework 类引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3942181/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com