c# - 此方法的参数预期是什么?

标签 c# methods arguments rhino3d

我正在尝试使用下面基于 RhinoCommonDivideByLength 方法SDK 但我不明白第三个参数是什么。我尝试基于此方法编写下面的代码,但收到以下错误消息:Error: 'Rhino.Geometry.Point3d' is a 'type' but is used like a 'variable'

我认为第三个参数是指定我想要点作为输出而不是 double 。我做错了什么?

方法:

Public Function DivideByLength ( _
    segmentLength As Double, _
    includeStart As Boolean, _
    <OutAttribute> ByRef points As Point3d() _
) As Double()

代码:

List<Point3d> pts = new List<Point3d>();

for(int i = 0; i < crv.Count;i = i + 2)
{
  pts.Add(crv[i].DivideByLength(nb, true, out Point3d()));
}

最佳答案

看起来这就是您要查找的内容:

List<Point3d[]> pts = new List<Point3d[]>();

for(int i = 0; i < crv.Count;i = i + 2)
{
  Point3d[] pointArray;
  crv[i].DivideByLength(nb, true, out pointArray);
  pts.Add(pointArray);
}

参见 out parameter documentation了解更多信息。

关于c# - 此方法的参数预期是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13311535/

相关文章:

methods - 静态类型语言中的多界方法?

c# - 按 Escape 键调用方法

c# - CA2122 DoNotIndirectlyExposeMethodsWithLinkDemands

c# - 使用 ASP.NET Core Identity 在 Cookie 中保存 token

java - 如何在 Java 中为公共(public)方法超时?

javascript - 这个 Angular 误差是多少?

arrays - 从 Powershell 使用数组参数调用构造函数

javascript - Racket(方案)中的arguments.callee?

c# - 如何在 .NET C# 中查找特定的 XML 标记

c# - InstallAllUsers 选项如何工作?