Quantcast
Channel: NI TestStand topics
Viewing all articles
Browse latest Browse all 6524

XML file to object deserialization

$
0
0

How can I implement similar deserialize functionality from XML to object as seen below on a .NET code snippet?

What I understand is that it is using the .NET System.XML.Serialization(4.0.0.0) GAC. If I select this GAC on a step using .NET adapter in TestStand2016 I can't see any classes. Is this correct way to do this?

Computer has .NET framework 4.6.1 SDK installed.

private Macro.Macro[] ReadMacroFile(string macroFileName)

{

FileStream fs = null;

try

{

var ser = newXmlSerializer(typeof(Macro.Macro[]));

fs = newFileStream((newFileInfo(macroFileName)).FullName, FileMode.Open);

var macroList = (Macro.Macro[])ser.Deserialize(fs);

return macroList;

}

finally

{

if (fs != null) fs.Close();

}

}

 

Best Regards

Petri


Viewing all articles
Browse latest Browse all 6524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>