1: using System; 2: using System.IO; 3: using System.Linq; 4: using System.Xml.Linq; 5: using System.Threading; 6: using System.Text; 7: using System.Globalization; 8: using System.Drawing; 9: using MyLib; 10: namespace CalcNamespace 11: { 12: public class CalcClass 13: { 14: public static string CalcMethod (dynamic[] arrInput ) 15: { 16: StringBuilder sbOutput= new StringBuilder(); //For output result 17: Thread newSingleThread = new Thread(delegate() 18: { 19: try 20: { 21: //------------------------------------------------------- 22: dynamic P=arrInput[0]; 23: dynamic V=arrInput[1]; 24: dynamic Z; 25: 26: Z =P * V; 27: 28: sbOutput.AppendLine("Acoustic Impedance(Ns/m3) "); 29: sbOutput.AppendLine(Z.ToString()); 30: //------------------------------------------------------- 31: } 32: catch(Exception ex) 33: { 34: sbOutput.AppendLine("An error occurred! Would you please check your code or input parameters?"); 35: sbOutput.AppendLine(ex.Message); 36: } 37: }); //Thread End 38: 39: newSingleThread.Start(); 40: newSingleThread.Join(8000); 41: return sbOutput.ToString(); 42: 43: }//Method End 44: } //Class End 45: } //NameSpace End 46:
|