1=================== Ant class ===============2 usingSystem;3 usingSystem.Collections.Generic;4 usingSystem.Linq;5 usingSystem.Text;6 usingSystem.Threading.Tasks;7 8 namespacekehouzuye.entity9 {Ten /// <summary> One ///Ant class A /// </summary> - Public classME - { the Public stringName {Get;Set; } - - PublicME (stringname) - { + This. Name =name; - } + /// <summary> A ///Say hello at /// </summary> - Public voidSayhai () - { -Console.WriteLine ("Hello, my name is"+Name); - } - in /// <summary> - ///Find Dessert to /// </summary> + Public voidTp (tianpin foop) - { theConsole.WriteLine ("I found a piece of dessert:"+Foop. Tpname); * } $ /// <summary>Panax Notoginseng ///Greeting Partners - /// </summary> the Public voidCount (intCount) + { AConsole.WriteLine ("I greeted"+ Count +"a partner! "); the } + /// <summary> - ///Handling Desserts $ /// </summary> $ Public voidGood () - { -Console.WriteLine ("Now, everyone begins to carry dessert! "); theConsole.WriteLine ("We finish our quest for dessert."); -Console.WriteLine ("Press any key to exit the------");Wuyi } the } -}
View Code
1============= Sweet category ==============2 usingSystem;3 usingSystem.Collections.Generic;4 usingSystem.Linq;5 usingSystem.Text;6 usingSystem.Threading.Tasks;7 8 namespacekehouzuye.entity9 {Ten Public classTianpin One { A Public stringTpname {Get;Set; } - - PublicTianpin (stringname) the { - This. Tpname =name; - } - } +}
View Code
============= Test Class ==========usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingkehouzuye.entity;namespacekehouzuye{ Public classProgram {Static voidMain (string[] args) {Me me=NewME ("Tiny"); Me. Sayhai (); Tianpin TP=NewTianpin ("Tiramisu"); Me. TP (TP); Me. Count (2); Me. Good (); Console.read (); } }}
S2t40. Depth. NET platform and C # programming) Chapter fourth. Brief answer 4. Lixiangyang. 20170406