.net - Why does Visual Studio use backing fields for WCF Service References? -


Many of you will know, I'll mark DataContract

For example, I can create a DataContract :

& lt; DataContract ()> Public Class fooClass

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. properties

This code design is "standard" style used by MS and 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; }  

In the client proxy class, you have the form of the backing field of some names like idField , nameField ...

Will be in

So it is not connected to WCF, it is a matter of fact that instead of using properties instead of using public areas for which you can easily get guidance.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -