/* Write a program to convert a given string to int, without using the int.tryparse or convert. * Also give an option to convert for a base other than 10. */ public void Main() { var ref1 = new StringToIntConverter(); int outputInt = 0; var testList = new [] {"1","234","abc","2#$","1sd34"}; foreach( var item in testList) { if (ref1.CustomTryParse(item, ref outputInt)) Console.WriteLine(outputInt); else Console.WriteLine("{0} is not an int", item); } }