Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通用类的delphixml文档_Delphi_Generics_Xml Documentation - Fatal编程技术网

通用类的delphixml文档

通用类的delphixml文档,delphi,generics,xml-documentation,Delphi,Generics,Xml Documentation,因此,我想记录我的类的方法,以便它能够与Help Insight一起工作。然后我发现了XML文档,所以我尝试使用它,但不管出于什么原因,它对我都不起作用 然后,我尝试做一些更简单的项目,而不是将此文档添加到现有的项目中,它工作得很好,因此通过实验,我发现这是因为我的类是泛型的。有人知道怎么解决吗?我是说。。这并不是很重要,但如果能用working Help Insight记录代码就好了 我添加了一个示例项目的代码 interface type whatever = class

因此,我想记录我的类的方法,以便它能够与Help Insight一起工作。然后我发现了XML文档,所以我尝试使用它,但不管出于什么原因,它对我都不起作用

然后,我尝试做一些更简单的项目,而不是将此文档添加到现有的项目中,它工作得很好,因此通过实验,我发现这是因为我的类是泛型的。有人知道怎么解决吗?我是说。。这并不是很重要,但如果能用working Help Insight记录代码就好了

我添加了一个示例项目的代码

interface
  type
   whatever = class
     public
     /// <summary> Remoified item from the collection </summary>
     /// <param name="Item">The item  remove </param>
     /// <param name="Collection"> item </param>
     /// <remarks> If parameter "Item" an exception is raised.
     /// <see cref="EArgumentNilException"/> </remarks>
     /// <returns> False is returned. </returns>
     function test(Item: Pointer; Collection: Pointer): Boolean;
   end;

   whatever<e> = class
     public
     /// <summary> from the collection </summary>
     /// <param name="Item">Te </param>
     /// <param name="Collection"> item </param>
     /// <remarks> an exception is raised.
     /// <see cref="EArgumentNilException"/> </remarks>
     /// <returns> False . </returns>
     function test(Item: Pointer; Collection: Pointer): Boolean;
   end;

  /// <summary> Removes the specified item from the collection </summary>
  /// <param name="Item">The item to remove </param>

  /// <param name="Collection">The group containing the item </param>
  /// <remarks> If parameter "Item" is null, an exception is raised.
  /// <see cref="EArgumentNilException"/> </remarks>
  /// <returns>True if the specified item is successfully removed;
  /// otherwise False is returned. </returns>
  function test(Item: Pointer; Collection: Pointer): Boolean;
implementation
...
接口
类型
无论什么=阶级
公众的
///从集合中重新指定项目
///项目将被删除
///项目
///如果参数“Item”,则引发异常。
///  
///返回False。
函数测试(项:指针;集合:指针):布尔值;
结束;
无论什么=阶级
公众的
///收藏
///Te
///项目
///提出了一个例外。
///  
///错。
函数测试(项:指针;集合:指针):布尔值;
结束;
///从集合中删除指定的项
///要删除的项目
///包含该项的组
///如果参数“Item”为null,则引发异常。
///  
///如果成功删除指定项,则为True;
///否则返回False。
函数测试(项:指针;集合:指针):布尔值;
实施
...
如您所见,我甚至使用了

它适用于“任意”类和单元方法,但不适用于

whatever<e> = class
whatever=class
我正在从其他单元进行测试:

var
we:whatever;
wee:whatever<integer>;
begin
  try
    test();
    we.test();
    wee.test();
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.
var
我们:随便;
维:随便;
开始
尝试
test();
we.test();
wee.test();
除了
关于E:Exception-do
Writeln(E.ClassName,“:”,E.Message);
结束;
结束。
我知道这不会被编译,但这无关紧要。 Insight help显示有关test()的请求文档;而我们。test();但在wee.test上,它只显示standart“在……中声明”

顺便说一句,在定义了方法的类中,insight help工作得很好(我的意思是,如果我将鼠标悬停在

fuction whatever<E>.test(Item, Collection : Pointer) : boolean;
function.test(项,集合:指针):布尔;
它将向我显示所需的文档,但它无法从外部工作

我还尝试为类型添加文档,但这对我没有帮助。 我不想要任何代码解决方案,在那里我必须添加方法才能使这项工作正常(但请随意发布它们,因为它们可以帮助其他人),我只是想知道我是否做了一些错误的事情,或者我必须设置一些东西,或者它是否不能与泛型类一起工作

Edit1:我怀疑RAD studio在用类型定义它的时候并没有把它看作是一个类(我想这是你使用泛型的方式,这很奇怪)

请原谅我奇怪的格式设置,因为它不允许我在普通文本中使用>和<,因为它用于链接

RAD Studio 10.1柏林更新2-刚刚发现它可能会有所帮助