我想获取.dll文件的xml文件的注释。
我正在构建一个代理类创建器(读取其中包含接口(interface)的 .dll(通过反射)--> 实现接口(interface)),现在我认为拥有方法的 header 和接口(interface)的参数会很好,但我不知道怎么做。
感谢您的回答,请原谅我糟糕的英语和糟糕的编码知识。
最佳答案
我找到了一个解决方案:
private static void ReadTheSummarys()
{
XmlReader xmlReader = XmlReader.Create("Test.xml");
bool isSummary = false;
while (xmlReader.Read())
{
//checks if the current node is a summaray
if (xmlReader.Name == "summary")
{
isSummary = true;
continue;
}
if (isSummary)
{
//Replace and trim for pure Comments without spaces and linefeeds
string summary = xmlReader.Value.Trim().Replace("\n", string.Empty);
if (summary != string.Empty)
{
//Writes the pure comment for checking
Console.WriteLine(summary);
}
isSummary = false;
}
}
}
关于c# - 如何从 XML 文件中读取摘要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22246127/