在此代码中,我返回[]x
和[]y
中某些操作的结果。我从文本文件中读取了它们的数据:
double[] x = File.ReadAllLines(@"E:\TestFile.txt").Aggregate("", (current, newLine) => current + " " + newLine).Split(' ').Where(s => !string.IsNullOrWhiteSpace(s)).Select(s => double.Parse(s)).ToArray();
double[] y = File.ReadAllLines(@"E:\TestFile2.txt").Aggregate("", (current, newLine) => current + " " + newLine).Split(' ').Where(s => !string.IsNullOrWhiteSpace(s)).Select(s => double.Parse(s)).ToArray();
SimpleDTW dtw = new SimpleDTW(x, y);
dtw.computeDTW();
double result = new SimpleDTW(x, y).computeFForward();
Console.WriteLine("the paramter is " +result);
我想找到我在函数中调用的两个参数的名称。
例如:当我按x,y
替换两个参数z,y
时,输入为the paramter is z,y
我想自动返回参数名称。 我想如果我们改变参数名称自动打印最新名称。
答案 0 :(得分:1)
如果你想获得参数的名称,你应该使用set和get方法,你可以保存参数的名称,或者你可以在c#中使用字典它会帮助你。
答案 1 :(得分:0)
不确定我理解你的问题。
我会将名称参数添加到SimpleDTW,
String XName {get; set;}
String Yname {get; set;}
ToString()方法:
public String ToString(){
return String.Format("The parameter is {0}: {1}, {2}:{3}",XName,X,YName,Y);
}