.net - Why does Visual Studio use backing fields for WCF Service References? -
Many of you will know, I'll mark For example, I can create a & lt; DataContract ()> Public Class fooClass DataContract
:
Datamember ()> String
Public fooString as the end class
When I add a service reference for the code that will receive this DataContract, I think That is the fasting in the class generated by the designer. As a public property with a backing field, my question is, why does the designer use a banking field? I do not see any reason not to reach fooString directly. This code design is "standard" style used by MS and In the client proxy class, you have the form of the backing field of some names like So it is not connected to WCF, it is a matter of fact that instead of using properties
properties
Instead of using public areas
for good reason, even if you have such data contracts on the server side:
[DataContract ] Class MyComplexType {[DataMember] Public Entry ID; [Datamember] the name of the public string; }
idField
, nameField
... properties
instead of using public areas
for which you can easily get guidance.
Comments
Post a Comment