c#中想调用dll文件后return多个值怎么办?

nwpughy nwpughy 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我的dll文件代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ceshi
{
public class Class1
{
double x;
double y;
double[,] A = new double[2, 2];

public double CHENGJI(double a, double b, double c, double d)
{
A[0, 0] = a;
A[0, 1] = b;
A[1, 0] = c;
A[1, 1] = d;
return x = 2 * A[1, 1] + A[0, 1] + A[0, 0] + A[1, 0];
y = 2 * A[1, 1];

}
}
}
我的控制台代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ceshi;

namespace ceshi1
{
class Program
{
static void Main(string[] args)
{
double x;
double y;
double a = 1, b = 2, c = 3, d = 4;
Class1 c1 = new Class1();//实例化对象
x = c1.CHENGJI(a, b, c, d);
y = c1.CHENGJI(a, b, c, d);
Console.WriteLine(x);
Console.WriteLine(y);
Console.ReadLine();
}
}
}

我理想中的运算值应该是x=14,y=8
但是总是显示x=14,y=14
就是说y的值没有返回过来
请问怎么在dll文件的函数里面返回多个值呢?
本人菜鸟,谢谢各位大神的指导
...全文

相关推荐

评论 8
收藏 已收藏
分享
返回顶部
nwpughy
C# 111,130 成员 642,541 内容