コード例 #1
0
 /// <summary>
 /// Creates and load, async, an updated XmlCurrencySheet
 /// </summary>
 /// <returns>Returns a Task<XmlCurrencySheet> that can be awaited in async contexts</returns>
 public static Task <XmlCurrencySheet> LoadAsync()
 {
     return(Task.Run(async() =>
     {
         XmlCurrencySheet sheet = new XmlCurrencySheet();
         await sheet.UpdateAsync();
         return sheet;
     }));
 }
コード例 #2
0
 /// <summary>
 ///  Creates and load, async, a XmlCurrencySheet from a stream
 /// </summary>
 /// <param name="source">The stream containg the XML data</param>
 /// <returns>Returns a Task<XmlCurrencySheet> that can be awaited in async contexts</returns>
 public static Task <XmlCurrencySheet> LoadAsync(Stream source)
 {
     return(Task.Run(async() =>
     {
         XmlCurrencySheet sheet = new XmlCurrencySheet();
         sheet._CurrencySheet = XDocument.Load(source);
         await sheet.InitializeCollectionAsync();
         return sheet;
     }));
 }