Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

read xml file in shared project

$
0
0

hi,

I want to read a xml file in the shared project from my forms app but I cant get it to work. This is my code:

var assembly = typeof(ContentPage).GetTypeInfo().Assembly;
Stream stream = assembly.GetManifestResourceStream("iBridge_RandstadMetaApp.Markup.xml");
Markup m = new Markup();
using (var reader = new System.IO.StreamReader(stream))
{
Debug.WriteLine("start xml");
var serializer = new XmlSerializer(typeof(Markup));
m = (Markup)serializer.Deserialize(reader);
}

public class Markup
{
public string BasicHexColor { get; set; }
public string TextColor { get; set; }

    public Markup ()
    {
    }
}

<?xml version="1.0" encoding="UTF-8" ?>

#2C7BDA
#2C7BBB


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>