[C#] Loading .tmx file

So Tiled is nice and all but how do I load a tmx file using xml in c#?

I know the following code is wrong but this is to give an idea of what I’m trying to achieve.

public float Version;
public float tiledVersion;
public string orientation;
public string renderorder;
public int width;
public int height;
public int tilewidth;
public int tileheight;
public bool infinite;
public int nextobjectid;
public int firstgid;
public string source;
public string name;
public int width;
public int height;
public string encoding;

edit: Ended up using this: https://github.com/marshallward/TiledSharp

edit-edit: apparently not, it’s out of date. Good times.

edit-edit-edit: never mind, was reading groups instead of layers. All sorted.

Glad to see you’ve sorted it out!

In case others are wondering the same thing, several options are listed on the Libraries and Frameworks page in the manual. I think indeed TiledSharp is a good option (though its main developer seems to no longer work on it, but he has still been reviewing pull requests).