1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.Linq;4 usingSystem.Text;5 6 namespaceTest067 {8 //class Class19 //{Ten //Public String Country () One // { A //string strcountry = "Example of a Method!"; - //return strcountry; - // } the //Public string Stradd () - // { - //Program MyProgram = new program (); - //string Strfield = myprogram.cc () + this. Country (); + //return Strfield; - // } + //} A //Class Program at //{ - //Public string Cc () - // { - //string STRCC = "This is a"; - //return STRCC; - // } in //static void Main (string[] args) - // { to //Class1 class1 = new Class1 (); + //Console.WriteLine (Class1.stradd ()); - // } the //} * classClass1//Two methods $ {Panax Notoginseng Public stringExam () - { the stringstrexam="example of a Method! "; + returnStrexam; A } the Public stringAdd () + { -Program program =NewProgram (); Instantiation of $ stringStradd = PROGRAM.XP () + This. Exam (); $ returnStradd; - } - } the class Program - {Wuyi Public stringXP () the { - stringKT ="this is a"; Wu returnkt; - About } $ - Static voidMain (string[] args)//(string[] args) The order is not wrong. Main Capital!!! - { -Class1 Class1 =NewClass1 (); Instantiation of
61
62
63
64
+}
Define two methods in a custom class, calling each other