Xamarin studio compiled this code

KennyBrightKennyBright USUniversity ✭✭
edited August 2016 in Xamarin University

Closing bracket for namespace is missing yet Xamarin Studio compiles code. when include, complains - "undefined symbol. strange!!!!

using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.IO;
using System.Threading.Tasks;
using System.Reflection;
using MyTunes.Shared;

namespace MyTunes
{
public static class SongLoader
{
//const string Filename = "songs.json";

    //public static IStreamLoader Loader
    //{
    //  get;
    //  set;
    //}
    //public static async Task<IEnumerable<Song>> Load()
    //{
    //  using (var reader = new StreamReader(OpenData())) {
    //      return JsonConvert.DeserializeObject<List<Song>>(await reader.ReadToEndAsync());
    //  }
    //}

    //private static Stream OpenData()
    //{
    //  // TODO: add code to open file here.
    //  if (Loader == null)
    //      throw new Exception("must set platform loader before calling load");


    //  return Loader.GetStreamFromFileName(Filename);
    //}


    //  not using plaform suppor
    const string ResourceName = "songs.json";
    public static async Task<IEnumerable<Song>> ImprovedLoad()
    {
        var assembly = typeof(SongLoader).GetTypeInfo().Assembly;
        using (var stream = assembly.GetManifestResourceStream(ResourceName))
        using (var reader = new StreamReader(stream))
        {
            return JsonConvert.DeserializeObject<List<Song>>(await reader.ReadToEndAsync());
        }
    }


}

Answers

Sign In or Register to comment.