最好的重载方法有一些无效的参数 [英] The best overloaded method has some invalid arguments
问题描述
foreach ( var item in finalList)
{
MatchInfo matchInfo = new MatchInfo();
matchInfo.CId = Convert.ToInt32(splitEnt [ 0 ]);
matchInfo.SId = Convert.ToInt32(splitEnt [ 1 ]);
matchInfo.SLabel = item.SLabel;
string [] Hours = item.HourString.Split( new string [] { ,},StringSplitOptions.RemoveEmptyEntries);
matchInfo.Hours = new List< byte>();
foreach ( var h in 小时)
matchInfo.Hours.Add(Convert.ToByte(h));
matchInfo.Duration = item.Duration;
matchInfo.Csts = new List< double>();
var query = 来自 sp studentInfoList
其中 sp.CId == matchInfo.CId
选择 sp ;
string [] csts = item.CstString.Split( new string [] { ,},StringSplitOptions.RemoveEmptyEntries);
foreach ( var s in csts)
matchInfo.Channels.Add(ConvertChannelToFrequency(Convert.ToInt32(s),matchInfo.SId,query.ToList()));
matchInfo.Hours = matchInfo .Hours.Distinct()ToList();
matchInfo.Csts = matchInfo.Csts.Distinct()。ToList();
match.Matches.Add(matchInfo);
}
-----------
public static double ConvertcstToFreq( int cst, short dsp,List< StudentInfo> studentList)
{
double freq =( double )cst * 0 。 10 +( double )studentist [dsp] .Bst / 2500 。 0 ;
return freq;
}
-
运行构建程序时我收到以下错误消息
< pre lang =xml>'Student.Web.Services.EventService的最佳重载方法匹配。
ConvertChannelToFrequency(int,short,System.Collections.Generic.List
< Student.Web .Services.StudentInfo > )'有一些无效的参数
错误行是:matchInfo .Csts.Add(ConvertCstToFreq(Convert.ToInt32(s),matchInfo.SId,query.ToList()));
请帮帮我...
或许:
matchInfo.Channels.Add(ConvertChannelToFrequency(转换) .ToInt32(s)),matchInfo.SId,query.ToList());
在你的帖子中你有1个参数添加,因为ConvertChannelToFrequency(最后以a结束)!
在我的示例之后。
foreach (var item in finalList)
{
MatchInfo matchInfo = new MatchInfo();
matchInfo.CId = Convert.ToInt32(splitEnt[0]);
matchInfo.SId = Convert.ToInt32(splitEnt[1]);
matchInfo.SLabel = item.SLabel;
string[] Hours = item.HourString.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
matchInfo.Hours = new List<byte>();
foreach (var h in Hours)
matchInfo.Hours.Add(Convert.ToByte(h));
matchInfo.Duration = item.Duration;
matchInfo.Csts = new List<double>();
var query = from sp in studentInfoList
where sp.CId == matchInfo.CId
select sp;
string[] csts = item.CstString.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
foreach (var s in csts)
matchInfo.Channels.Add(ConvertChannelToFrequency(Convert.ToInt32(s), matchInfo.SId, query.ToList()));
matchInfo.Hours = matchInfo.Hours.Distinct().ToList();
matchInfo.Csts = matchInfo.Csts.Distinct().ToList();
match.Matches.Add(matchInfo);
}
-----------
public static double ConvertcstToFreq(int cst, short dsp, List<StudentInfo> studentList)
{
double freq = (double)cst * 0.10 + (double)studentist[dsp].Bst / 2500.0;
return freq;
}
--
When run the build the program i got below error message
The best overloaded method match for 'Student.Web.Services.EventService.
ConvertChannelToFrequency(int, short, System.Collections.Generic.List
<Student.Web.Services.StudentInfo>)' has some invalid arguments
Error line is : matchInfo.Csts.Add(ConvertCstToFreq(Convert.ToInt32(s), matchInfo.SId, query.ToList()));
please help me...
perhaps:
matchInfo.Channels.Add(ConvertChannelToFrequency(Convert.ToInt32(s)), matchInfo.SId, query.ToList());
in your post you have 1 argument in the Add because ConvertChannelToFrequency( is closed with a ) at the end!
In my example after (s).
这篇关于最好的重载方法有一些无效的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!