# \[C#\] Loading .tmx file

**URL:** <https://discourse.mapeditor.org/t/c-loading-tmx-file/3352>\
**Category:** Questions\
**Created:** [August 10, 2018, 7:37pm UTC](https://discourse.mapeditor.org/t/c-loading-tmx-file/3352 "2018-08-10T19:37:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ThimbleFire](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@ThimbleFire](https://discourse.mapeditor.org/u/ThimbleFire)\
**Post date:** [August 10, 2018, 7:37pm UTC](https://discourse.mapeditor.org/t/c-loading-tmx-file/3352/1 "2018-08-10T19:37:45Z")

</div>

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.

```
[XmlAttribute("map")]
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;
[XmlAttribute("tileset")]
public int firstgid;
public string source;
[XmlAttribute("layer")]
public string name;
public int width;
public int height;
[XmlAttribute("encoding")]
public string encoding;

```

edit: Ended up using this: [https://github.com/marshallward/TiledSharp](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.

---

<div class="post-metadata">

**Author:** ![bjorn](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/bjorn/32/1599_2.png) [@bjorn](https://discourse.mapeditor.org/u/bjorn)\
**Post date:** [August 14, 2018, 10:58am UTC](https://discourse.mapeditor.org/t/c-loading-tmx-file/3352/2 "2018-08-14T10:58:58Z")

</div>

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](http://doc.mapeditor.org/en/stable/reference/support-for-tmx-maps/#c-net) 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).
