【问题标题】:How do I read the summary out of an XML file如何从 XML 文件中读取摘要
【发布时间】:2014-09-19 16:36:22
【问题描述】:

我想获取 .dll 文件的 xml 文件的 cmets。

我正在构建一个代理类创建器(读取一个带有接口的 .dll(通过反射)-> 实现接口),现在我认为拥有接口的方法和参数的标头会很好,但我不知道怎么做。

感谢您的回答,请原谅我糟糕的英语和糟糕的编码知识。

【问题讨论】:

标签: c# xml


【解决方案1】:

我找到了解决方案:

   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;
    }

    }

    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-02-03
    • 2021-12-15
    • 1970-01-01
    • 2011-08-06
    • 2010-11-20
    • 2020-01-13
    • 1970-01-01
    相关资源
    最近更新 更多