C# 如何从XML文件中读取摘要
我想获取.dll文件的xml文件的注释 我正在构建一个代理类创建者(通过反射读取带有接口的.dll-->实现接口),现在我想最好有接口的方法和参数的头,但我不知道如何创建 感谢您的回答,请原谅我英语不好和编码知识差。我找到了一个解决方案:C# 如何从XML文件中读取摘要,c#,xml,C#,Xml,我想获取.dll文件的xml文件的注释 我正在构建一个代理类创建者(通过反射读取带有接口的.dll-->实现接口),现在我想最好有接口的方法和参数的头,但我不知道如何创建 感谢您的回答,请原谅我英语不好和编码知识差。我找到了一个解决方案: private static void ReadTheSummarys() { XmlReader xmlReader = XmlReader.Create("Test.xml"); bool isSummary = fa
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;
}
}
}
此库的可能副本可能很有用:@Bio42“comments”有点误导,因为您试图阅读文档xml。您尝试过吗?它可以根据xml注释生成帮助文件