Msgstr "Publish modifier is invalid for this item" in interface method

Ok, so I am having problems calling the GetClassAverage () method from interfacce (a window form displaying data). I also get the following error: "The public modifier is not valid for this element" ... this is the code of my IService.cs file

[ServiceContract]
public interface IClassRollService
{
    [OperationContract]
    List<Student> GetStudentList(int semester);
    [OperationContract]    
    double GetClassAverage(int anything);
}

In my Service.cs file I have

public double GetClassAverage()
{
    double sum = 0.0;
    double total;
    foreach (Student S in Students)
    {
        sum += S.Average;
    }
    return total = sum / Students.Count();
}

In my window form, I populate gridview by calling client.GetStudentList (), but it does not work for GetClassAverage ()

What am I doing wrong or what am I missing?

[EDIT] The public has already been taken out, but I still can't call the method from the Windows form. Is there any other way to get the return value of this method in a Windows form. It has something to do with web services that I know.

+3
source
2

. , "public" . "public" , .

+15

IService.cs . Service.cs :

public double GetClassAverage()

to

public double GetClassAverage(int anything)
+5

All Articles