Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
C#
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);
                    }

-----------
C#
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
XML
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...
Posted
Updated 10-Feb-15 23:15pm
v3
Comments
Kornfeld Eliyahu Peter 11-Feb-15 5:08am    
Check the type of this: query.ToList()

1 solution

perhaps:

C#
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).
 
Share this answer
 
Comments
Rnshanmugavadivel 11-Feb-15 5:24am    
I changed my code but i got below error

No overload for method 'ConvertCstoFreq' takes 1 arguments

No overload for method 'Add' takes 3 arguments
Herman<T>.Instance 11-Feb-15 5:26am    
how does your method ConvertChannelToFrequency looks like then? Does that method not have parameters?
Still the same line when the exception occurs?
and how does matchInfo.Channels.Add() looks like? which parameters needed there?
Herman<T>.Instance 11-Feb-15 5:31am    
ahhh. now I see:
remember: short == Int16
public static double ConvertcstToFreq(int cst, short dsp, List<studentinfo> studentList)
matchInfo.SId => matchInfo.SId = Convert.ToInt32(splitEnt[1]);
In16 != Int32
Rnshanmugavadivel 11-Feb-15 5:37am    
matchInfo.CId = Convert.ToInt32(splitEnt[0]);
matchInfo.SId = Convert.ToInt32(splitEnt[1]);
var query = from sp in studentInfoList
where sp.CId == matchInfo.CId select sp;

CId,SId and query these parameters are needed.

matchinfo.cst.add look like (850.56,896.58,....)
Herman<T>.Instance 11-Feb-15 5:39am    
you made them Int32 while your method wants Int16 (short). So better change the method to have the dsp parameter set to Int32

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900