开发者

WCF custom DataContract/DataMember and CA1811: Avoid uncalled private code

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 开发者_如何学Conly 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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜