Skip to content

Commit 9665c12

Browse files
adamsitnikjeffhandleygewarren
authored
Mention how non-public fields of inherited classes are serialized (#47148)
* Mention how non-public fields of inherited classes are serialized * Fix grammar per review feedback Co-authored-by: Genevieve Warren <[email protected]> --------- Co-authored-by: Jeff Handley <[email protected]> Co-authored-by: Genevieve Warren <[email protected]>
1 parent 11e4b10 commit 9665c12

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/standard/serialization/binaryformatter-migration-guide/functionality-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The <xref:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter> was fi
2020

2121
## Member names
2222

23-
In most common scenario, the type is annotated with `[Serializable]` and the serializer uses reflection to serialize **all fields** (both public and non-public) except those that are annotated with `[NonSerialized]`. By default, the serialized member names will match the type's field names. This historically led to incompatibilities when even private fields are renamed on `[Serializable]` types. During migrations away from BinaryFormatter, it becomes necessary to understand how serialized field names were handled and overridden.
23+
In the most common scenario, the type is annotated with `[Serializable]` and the serializer uses reflection to serialize **all fields** (both public and non-public) except those that are annotated with `[NonSerialized]`. By default, the serialized member names of public fields will match the type's field names. For non-public fields defined in inherited classes, the member names consist of inherited type name, a `+` sign, and the field name (`$InheritedClassName+$nonPublicFieldName`). Serializing field names has historically led to incompatibilities when even private fields are renamed on `[Serializable]` types. During migrations away from BinaryFormatter, it became necessary to understand how serialized field names were handled and overridden.
2424

2525
### C# auto properties
2626

0 commit comments

Comments
 (0)