using System.Collections.Generic;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO.Compression;
public static void Test()
XElement ticketRootXElement = XElement.Parse(GetXml());
var featureName = "psk:PageMediaSize";
var newOptionValue = "psk:ISOA3";
XNamespace xns_psf = @"http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework";
var query = from f in ticketRootXElement.DescendantsAndSelf(xns_psf + "Feature")
where (string)f.Attribute("name") == featureName
f.Element(xns_psf + "Option").SetAttributeValue("name", newOptionValue);
Console.WriteLine(ticketRootXElement);
Assert.IsTrue(ticketRootXElement.ToString().Contains(newOptionValue));
var xml = @"<?xml version=""1.0""?>
<psf:Feature xmlns:psf=""http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework"" name=""psk:PageMediaSize"">
<psf:Option name=""psk:ISOA4"">
<psf:ScoredProperty name=""psk:MediaSizeWidth"">
<psf:Value xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:type=""xsd:integer"">210000</psf:Value>
<psf:ScoredProperty name=""psk:MediaSizeHeight"">
<psf:Value xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:type=""xsd:integer"">297000</psf:Value>
public static void Main()
Console.WriteLine("Environment version: {0} ({1})", System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription , GetNetCoreVersion());
Console.WriteLine("Failed with unhandled exception: ");
public static string GetNetCoreVersion()
var assembly = typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly;
var assemblyPath = assembly.CodeBase.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries);
int netCoreAppIndex = Array.IndexOf(assemblyPath, "Microsoft.NETCore.App");
if (netCoreAppIndex > 0 && netCoreAppIndex < assemblyPath.Length - 2)
return assemblyPath[netCoreAppIndex + 1];