1

I got a WCF service, and one of the return objects is:

[DataContract]
sealed class Class1
{
    [DataMember]
    public int Prop1 { get; private set; }
    ...
}

Incidentially, one of the properties, let's say it's this Prop1, I only set within the service, and then read in the client.

This, however, produces CA1811: Avoid uncalled private code on the .get() of Prop1.

Am I doing something wrong, or should I ignore this warning, or should I do something differently?

avance70
  • 787
  • 1
  • 11
  • 22

1 Answers1

2

You are not really doing anything wrong. The warning is raised because the getter is never called on the service side; which is where the analyzed code resides. I think you can safely ignore the warning

Edwin de Koning
  • 14,209
  • 7
  • 56
  • 74