using System; class tlist { public static void Main(string[] argv) { Console.WriteLine( @"using System; using System.Text; using System.Collections; using System.Reflection;" ); foreach (string arg in argv) { string def = body; if (arg == "int" || arg == "string") def = Repl(def, "", ", IImage") + body2; else def = Repl(def, "", ""); def = Repl(def, "", arg); Console.WriteLine("{0}{1}", def, "}"); } } static string Repl(string str, params string[] pairs) { for (int i = 0; i < pairs.Length; i += 2) str = str.Replace(pairs[i], pairs[i+1]); return str; } const string body = @" public class List : CollectionBase, IList { // Constructors public List() : base() {} public List(ICollection c) : base() { foreach ( item in c) Add(item); } public List(params [] items) : this((ICollection)items) {} public static List New(params [] items) { return new List(items); } // Properties public this[int index] { get { return ()InnerList[index]; } set { InnerList[index] = value; } } // Methods public int Add( value) { return InnerList.Add(value); } public void AddRange(ICollection c) { foreach ( x in c) Add(x); } public bool Contains( value) { return InnerList.Contains(value); } public int IndexOf( value) { return InnerList.IndexOf(value); } public void Insert(int index, value) { InnerList.Insert(index, value); } public void Remove( value) { InnerList.Remove(value); } public void Sort() { InnerList.Sort(); } public int BinarySearch( value) { return InnerList.BinarySearch(value); } class enumerator : IEnumerator { IEnumerator InnerEnumerator; public enumerator(IEnumerator InnerEnumerator) { this.InnerEnumerator = InnerEnumerator; } object IEnumerator.Current { get { return InnerEnumerator.Current; } } public Current { get { return ()InnerEnumerator.Current; } } public bool MoveNext() { return InnerEnumerator.MoveNext(); } public void Reset() { InnerEnumerator.Reset(); } } public new IEnumerator GetEnumerator() { return new enumerator(base.GetEnumerator()); } "; const string body2 = @" // IImage string IImage.Image() { return Debug.Image(this); } "; }