Modding:Network API: Difference between revisions

From Vintage Story Wiki
Line 52: Line 52:
The argument we pass to <code>ProtoContract</code> makes it so all <code>public</code> fields will be serialized; without this, we'd declare fields for serialization by using <code>ProtoMember</code> attributes. If we chose this approach, we'd write our classes like so:
The argument we pass to <code>ProtoContract</code> makes it so all <code>public</code> fields will be serialized; without this, we'd declare fields for serialization by using <code>ProtoMember</code> attributes. If we chose this approach, we'd write our classes like so:
<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
[ProtoContract()]
[ProtoContract]
     public class NetworkApiTestMessage
     public class NetworkApiTestMessage
     {
     {