Good day. Began to deal with wcf
. I started with standard examples - mathematical operations, but slightly complicating the task I ran into a problem, I cannot change the data.
There is an interface
[ServiceContract] public interface IScoreboard { [OperationContract] int GetCount(); [OperationContract] int AddLine(string line, bool weather); [OperationContract] int DeleteLine(int _id); [OperationContract] string GetLine(int _id); }
There is a class
[DataContract] public class ServiceScoreboard : IScoreboard { public Line[] note = new Line[24]; public int _id = 0; public int GetCount() { return _id; } public int AddLine(string line, bool weather) { if (_id < 24) { Line lineToAdd = new Line(line, weather); lineToAdd.SetId(_id); note[_id] = lineToAdd; _id++; return _id; } else return -1; } public string GetLine(int _id) { return note[_id].GetLine(); } }
the problem was that I could not change the values of the class properties
@petya thanks, helped