using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo
{
struct CustomerName
{
public string firstName, lastName;
public string Name()
{
return firstName+" "+lastName;
}
}
class Program
{
static void Main(string[] args)
{
CustomerName myCustomer;
myCustomer.firstName = "Ji";
myCustomer.lastName = "Qing";
Console.WriteLine("客户的名字:{0}", myCustomer.Name());
Console.ReadKey();
}
}
}
结构struct函数,有意思。可以尝试利用这个特性。
本文转自TBHacker博客园博客,原文链接:http://www.cnblogs.com/jiqing9006/p/6748212.html,如需转载请自行联系原作者