【发布时间】:2019-06-05 22:09:51
【问题描述】:
我是 C# 的新手。我想知道代码中是否有可能有很多返回。 我的代码目前无法正常工作。见下文:
public static int GeometryandControlPoints(int t, double rinn, double rout, int nx, int ny, int poly)
{
int nel, n, m, ncp, gdof;
nel = nx * ny;
n = nx + poly;
m = ny + poly;
ncp = n * m;
gdof = 2* ncp;
return (nel, n, m, ncp, gdof);
}
错误位于return 行,如下图所示。
【问题讨论】:
-
您必须声明返回类型列表。喜欢
public static (int nel, int n, int m, int ncp, int gdof) Geometry...(...) -
你的返回类型应该是 (int , int (等等)) 在这里阅读元组docs.microsoft.com/en-us/dotnet/csharp/tuples
-
请勿张贴代码图片。将实际代码发布到问题中。有时为了提供帮助,有人会将您的代码复制并粘贴到 Visual Studio 中,以便他们可以使用它。他们不能用图片做到这一点。这意味着这个问题不是独立的。有人应该能够在一个页面上看到问题(及其代码)和答案。
-
解释你的目标是什么也很有帮助as well as what you are doing。可能有一种更有效或更惯用的方式来实现您的目标。
标签: c#