So I am aware that in general, this is not possible because Jon Skeet said so.
But my .cs files are simple classes with one or two usings at the top. And I need one file with all the classes in it so I can paste it into a web browser IDE as a single file to compile and run.
I tried using PowerShell, and just copy all files into one like this:
get-content *.cs | out-file bigBadFile.cs
But this file will not compile because it has usings in the middle, which isn't allowed:
CS1529: A using clause must precede all other elements defined in the namespace except extern alias declarations
If you are curious why I need that - it's for the CodinGame platform, and I'm sick of keeping all my code in a single file.
Sample files to merge:
GameData.cs:
using System.Collections.Generic;
public class GameData
{
public GameData(int width, int height)
{
...
}
public int Width { get; set; }
public int Height { get; set; }
public List<int> List { get; set; }
...
}
Player.cs:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
public class Player
{
private static string[] inputs;
private static bool isFirstTurn = true;
public static StringBuilder MoveBuilder;
public static GameData Game;
static void Main()
{
...
}
}