You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Construct an instance of the XmlSerializer with the type
// of object that is being deserialized.
var mySerializer = new XmlSerializer(typeof(MySerializableClass));
// To read the file, create a FileStream.
using var myFileStream = new FileStream("myFileName.xml", FileMode.Open);
// Call the Deserialize method and cast to the object type.
var myObject = (MySerializableClass)mySerializer.Deserialize(myFileStream);
the semicolon at the end of the using statement causes the following myFileStream to be undefined
Type of issue
Code doesn't work
Description
In the example
// Construct an instance of the XmlSerializer with the type
// of object that is being deserialized.
var mySerializer = new XmlSerializer(typeof(MySerializableClass));
// To read the file, create a FileStream.
using var myFileStream = new FileStream("myFileName.xml", FileMode.Open);
// Call the Deserialize method and cast to the object type.
var myObject = (MySerializableClass)mySerializer.Deserialize(myFileStream);
the semicolon at the end of the using statement causes the following myFileStream to be undefined
Page URL
https://learn.microsoft.com/en-us/dotnet/standard/serialization/how-to-deserialize-an-object
Content source URL
https://github.com/dotnet/docs/blob/main/docs/standard/serialization/how-to-deserialize-an-object.md
Document Version Independent Id
b204adb3-855a-db49-a25c-71df4daf5988
Article author
@gewarren
Metadata
The text was updated successfully, but these errors were encountered: