params []变量是否可以保存一个列表,该列表已作为参数通过C#中的方法传递?
写了一个方法(AddIntegers),需要将多个值作为参数.在方法的参数列表中,当在Main方法中进行方法调用时,有一个params []变量正在接收抛出的值.但有一个例外,说"无法从system.collections.generic.List <>转换为整数.任何人都知道为什么会发生这种情况?
**** this is within the Main Method****
string Demostring = Console.ReadLine();
string[] tokens = Demostring.Split(',');
List<int> nums = new List<int>();
int oneNum;
foreach(string s in tokens)
{
if (Int32.TryParse(s, out oneNum))
nums.Add(oneNum);
}
int result1 = AddIntegers(nums);
**** this is the method to be called****
public static int AddIntegers(params int[] Restnum)
{
int result = 0;
foreach(int temp in Restnum)
{
result += temp;
}
return result;
}
Run Code Online (Sandbox Code Playgroud) 所以基本问题是我正在设置一个 Amazon connect 实例并且也已成功开始录制通话,但我希望录制音频文件以某种格式(.mp3、.mp4 等)存储在 S3 存储桶中,而不是默认由 Amazon 提供 (.wav)。