标签:使用 cti bsp this关键字 main linq code threading new
Class1.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Class1 { private string name; public Class1(string name) { // 使用this关键字表明使用当前对象的属性(或方法),后面的name是形参name this.name = name; } public void Eat() { Console.WriteLine("名字:" + this.name); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { // 使用类 Class1 myname = new Class1("namejr"); myname.Eat(); } } }
标签:使用 cti bsp this关键字 main linq code threading new
原文地址:https://www.cnblogs.com/namejr/p/10260959.html