成都创新互联网站制作重庆分公司

c#中的命名实参

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

创新互联专业为企业提供海口网站建设、海口做网站、海口网站设计、海口网站制作等企业网站建设、网页设计与制作、海口企业网站模板建站服务,十载海口做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。

namespace ConsoleApplication1
{
class Program
{

     class Class1
     {
         readonly string people;
        public string People { get {return people;} }
        readonly decimal price;
        public decimal Price { get { return price; } }
        public Class1(string people, decimal price)
        {
            this.people = people;
            this.price = price;
        }

        public static List kkk()
        {
            return new List {
    new Class1(people:"ssss",price:444m),
    new Class1(people:"44333rrr",price:666m),
    new Class1(people:"dddd",price:88m)

    };

    }
        public override string ToString()
        {
            return string.Format("{0}:{1}",people,price);
        }

        static void Main(string[] args)
        {
           foreach(Class1 jjj in kkk())
           { Console.WriteLine(jjj.people+':'+jjj.price);

           }
           Console.ReadLine();
        }
    }
}

}


网页标题:c#中的命名实参
网站网址:http://cxhlcq.cn/article/iihhgc.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部