# C# generation creates loads of "side" classes and files: how to prevent that

**URL:** <https://community.haxe.org/t/c-generation-creates-loads-of-side-classes-and-files-how-to-prevent-that/1800>\
**Category:** Haxe\
**Tags:** haxe-cs\
**Created:** [June 10, 2019, 9:40pm UTC](https://community.haxe.org/t/c-generation-creates-loads-of-side-classes-and-files-how-to-prevent-that/1800 "2019-06-10T21:40:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoRabbit](https://community.haxe.org/user_avatar/community.haxe.org/norabbit/32/372_2.png) [@NoRabbit](https://community.haxe.org/u/NoRabbit)\
**Post date:** [June 10, 2019, 9:40pm UTC](https://community.haxe.org/t/c-generation-creates-loads-of-side-classes-and-files-how-to-prevent-that/1800/1 "2019-06-10T21:40:05Z")

</div>

Hi there,

I have 1 Main.hx file with just over 100 lines of code. I use Std.parseInt and arrays.  
When I tell the haxe compiler to only generate the c# code, it also creates loads of classes on top of my very simple haxe class.

Is there a way to prevent that ? Or is there a way to only generate 1 cs file with all the needed classes ?

Thx.

---

<div class="post-metadata">

**Author:** ![nadako](https://community.haxe.org/user_avatar/community.haxe.org/nadako/32/5_2.png) [@nadako](https://community.haxe.org/u/nadako)\
**Post date:** [June 11, 2019, 9:54am UTC](https://community.haxe.org/t/c-generation-creates-loads-of-side-classes-and-files-how-to-prevent-that/1800/2 "2019-06-11T09:54:49Z")

</div>

Nope, unfortunately the C# target is currently not very optimized for hello-world size programs and it always generates some support code even if it’s not actually used. There were some improvements in Haxe 4 regarding that, but it’s still not perfect.

---

<div class="post-metadata">

**Author:** ![sundialservices](https://avatars.discourse-cdn.com/v2/letter/s/9e8a1a/32.png) [@sundialservices](https://community.haxe.org/u/sundialservices)\
**Post date:** [June 11, 2019, 2:20pm UTC](https://community.haxe.org/t/c-generation-creates-loads-of-side-classes-and-files-how-to-prevent-that/1800/3 "2019-06-11T14:20:15Z")

</div>

_Heh …_ Lots of systems do that sort of thing, although they’re usually generating object-code not source so you don’t so-readily see it. Back in the day, I tried very hard to get Delphi to produce a “command-line hello-world program” that was smaller than a couple megabytes but never succeeded. 🙂

But it’s okay, of course, because you don’t use Delphi to produce “command-line hello-world programs.” When you start building the kind of stuff that the tool was made for, the foundational code that it adds in will probably be used. “Minimizing output file-size” is not a significant design consideration, within reason, as long as it works.

(And of course, the C# compiler might “optimize away” a lot of the cruft as _it_ generates a final binary.)

---

<div class="post-metadata">

**Author:** ![NoRabbit](https://community.haxe.org/user_avatar/community.haxe.org/norabbit/32/372_2.png) [@NoRabbit](https://community.haxe.org/u/NoRabbit)\
**Post date:** [June 15, 2019, 4:24pm UTC](https://community.haxe.org/t/c-generation-creates-loads-of-side-classes-and-files-how-to-prevent-that/1800/4 "2019-06-15T16:24:30Z")

</div>

Allright, thx for the reply !
