0

I have this code in my WCF server:

public struct Detail
{
    public String ID;
    public String Event;
    public String Date;
    public String Title;
    public String Content;
    public String Type;

}


public class Service1 : IService1
{

    LINQDataContext LINQ = new LINQDataContext();

    public Detail[] AllNews()
    {
        var ResultLoad = LINQ.Show_All().ToList();
        int count = ResultLoad.Count();
        Detail[] News = new Detail[1000];
        for (int i = 0; i < count; i++)
        {
            News[i].ID = ResultLoad[i].Id.ToString();
            News[i].Event = ResultLoad[i].Event;
            News[i].Date = ResultLoad[i].Date;
            News[i].Title = ResultLoad[i].Title;
            News[i].Content = ResultLoad[i].Content;
            News[i].Type = ResultLoad[i].Type;
        }
        return News;
    }

}

I want to receive News data in my Client app. I use this code, but it doesn't work:

ServiceReference1.Service1Client Client = new ServiceReference1.Service1Client();
        Detail[] MainNews = new Detail[1000];

        MainNews = Client.AllNews;

How can I receive News data from WCF in main client app?

Rüdiger Herrmann
  • 20,512
  • 11
  • 62
  • 79
JAC
  • 950
  • 1
  • 7
  • 11

0 Answers0