I would like to combine multiple c# files into one file that will compile without user correction. This is for some online contests that will only accept 1 single file for solutions. This would need to merge all the usings, namespaces and classes.
As an Example, if I had 2 files MyThing.cs and GenericPair.cs I would like to merge them onto a single file, Merged.cs.
A Visual Studio plugin would be ideal but running a command line tool against a project directory is good if it gets the job done.
MyThing.cs
using System.Drawing;
namespace test
{
public class Thing
{
public Point Position;
public Thing(Point p)
{
Position = p;
}
}
}
GenericPair.cs
using System;
namespace test2ndNamespace
{
public class GenericPair<T> where T : IComparable
{
public T P;
public T Q;
public GenericPair(T p, T q)
{
P = p;
Q = q;
}
}
}
Merged.cs
using System;
using System.Drawing;
namespace test
{
public class Thing
{
public Point Position;
public Thing(Point p)
{
Position = p;
}
}
}
namespace test2ndNamespace
{
public class GenericPair<T> where T : IComparable
{
public T P;
public T Q;
public GenericPair(T p, T q)
{
P = p;
Q = q;
}
}
}