Full Source Code

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 Vi=arrInput[0];
23:              dynamic Ti=arrInput[1];
24:              dynamic Vf=arrInput[2];
25:              dynamic Tf;
26:              
27:              Tf = Vf*Ti*1.0/Vi;
28:              
29:              sbOutput.AppendLine("Final Temperature (K)  ");
30:              sbOutput.AppendLine(Tf.ToString());
31:              //-------------------------------------------------------
32:               }
33:               catch(Exception ex)
34:               {
35:                  sbOutput.AppendLine("An error occurred! Would you please check your code or input parameters?");
36:                  sbOutput.AppendLine(ex.Message); 
37:               }
38:           }); //Thread End
39:  
40:           newSingleThread.Start();
41:           newSingleThread.Join(8000);
42:           return sbOutput.ToString();
43:  
44:        }//Method End
45:     } //Class End
46:  } //NameSpace End
47: