XAML-Map-Control/MapControl/Shared/XDocument.cs

19 lines
516 B
C#
Raw Normal View History

2025-09-19 11:53:25 +02:00
using System.IO;
using System.Threading.Tasks;
using System.Xml.Linq;
2026-04-13 17:14:49 +02:00
namespace MapControl;
internal static class XDocument
2025-09-19 11:53:25 +02:00
{
2026-04-13 17:14:49 +02:00
public static async Task<XElement> LoadRootElementAsync(Stream stream)
2025-09-19 11:53:25 +02:00
{
#if NETFRAMEWORK
2026-04-13 17:14:49 +02:00
var document = await Task.Run(() => System.Xml.Linq.XDocument.Load(stream, LoadOptions.None));
2025-09-19 11:53:25 +02:00
#else
2026-04-13 17:14:49 +02:00
var document = await System.Xml.Linq.XDocument.LoadAsync(stream, LoadOptions.None, System.Threading.CancellationToken.None);
2025-09-19 11:53:25 +02:00
#endif
2026-04-13 17:14:49 +02:00
return document.Root;
2025-09-19 11:53:25 +02:00
}
}