mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-08 16:05:50 +00:00
XDocument.LoadRootElementAsync
This commit is contained in:
parent
fedf5eba12
commit
cd40a627ce
6 changed files with 53 additions and 42 deletions
19
MapControl/Shared/XDocument.cs
Normal file
19
MapControl/Shared/XDocument.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace MapControl
|
||||
{
|
||||
internal static class XDocument
|
||||
{
|
||||
public static async Task<XElement> LoadRootElementAsync(Stream stream)
|
||||
{
|
||||
#if NETFRAMEWORK
|
||||
var document = await Task.Run(() => System.Xml.Linq.XDocument.Load(stream, LoadOptions.None));
|
||||
#else
|
||||
var document = await System.Xml.Linq.XDocument.LoadAsync(stream, LoadOptions.None, System.Threading.CancellationToken.None);
|
||||
#endif
|
||||
return document.Root;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue