static void Main(string[] args) { try { ClassLibrary3.Class1 class1 = new ClassLibrary3.Class1(); foreach (var field in class1.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic)) { Console.WriteLine(string.Format("{0} {1}", field.Name, field.FieldType)); } class1.DoCalculations(); class1.DoSomeJob(); class1.DoSomeOtherJob(true); class1.DoSomeOtherJob(false); class1.DoFancyWork(); //class1.AddIntegers(1, 3, true); //class1.AddIntegers(1, 3, false); //class1.AddIntegers(1, 3, null); //class1.DoAllJobs(); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } finally { Console.WriteLine("DONE! Press Enter"); Console.ReadLine(); } }
private void button2_Click(object sender, EventArgs e) { try { double a, b, c; a = Convert.ToDouble(textBox4.Text); b = Convert.ToDouble(textBox6.Text); c = Convert.ToDouble(textBox5.Text); ClassLibrary3.Class1 cc = new ClassLibrary3.Class1(a, b, c); textBox8.Text = cc.clac().ToString(); } catch (Exception ex) { using (FileStream fs = File.Open(Resource1.log, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)) { using (StreamWriter sw = new StreamWriter(fs)) { sw.WriteLine(ex.Message); sw.WriteLine(ex.TargetSite); sw.WriteLine(ex.StackTrace); sw.WriteLine(ex.InnerException); sw.WriteLine(ex.HResult); sw.WriteLine(DateTime.Now); sw.Flush(); sw.Close(); } fs.Close(); } } }
protected void Page_Load(object sender, EventArgs e) { ClassLibrary1.Class1 class1 = new ClassLibrary1.Class1(); ClassLibrary2.Class1 class2 = new ClassLibrary2.Class1(); ClassLibrary3.Class1 class3 = new ClassLibrary3.Class1(); Response.Write(Session["TEST"].ToString()); Response.Write(Session["TEST2"].ToString()); Response.Write(class1.Test()); Response.Write(class2.Test()); Response.Write(class3.Test()); }
static void Main(string[] args) { double a, b, c; Console.WriteLine("请输入三角形一边边长"); a = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("请输入三角形第二边边长"); b = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("请输入三角形夹角角度(角度制)"); c = Convert.ToDouble(Console.ReadLine()); ClassLibrary2.Class1 cclass = new ClassLibrary2.Class1(a, b, c); Console.WriteLine(cclass.clac().ToString()); double d, e, f; Console.WriteLine("请输入三角形一边边长"); d = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("请输入三角形第二边边长"); e = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("请输入三角形第三边边长"); f = Convert.ToDouble(Console.ReadLine()); ClassLibrary3.Class1 cc = new ClassLibrary3.Class1(d, e, f); Console.WriteLine(cc.clac().ToString()); Console.ReadKey(); }