zoukankan      html  css  js  c++  java
  • C#3.0技术探讨(1):匿名类型 Anonymouse Type

    /*--===------------------------------------------===---
    匿名类型: Anonymouse Type

    --===------------------------------------------===---
    private static void Main()
    {
        int[] numArray = new int[] { 3, 5, 1, 9, 2 };
        foreach (int num in numArray)
        {
            Console.Write("{0}\t", num);
        }
        var type = new {
            firstname = "xu",
            lastname = "minghui",
            age = 0x24
        };
        Console.WriteLine("\n{0} {1},今年{2}岁。", type.firstname, type.lastname, type.age);
    }
    --===------------------------------------------===---
    */
    class xumhLinq
    {
        
    static void Main()
        {
            
    //int[] score={3,5,1,9,2};
            var score=new []{3,5,1,9,2};    //匿名类型
            foreach(var v in score)
                System.Console.Write(
    "{0}\t",v);

            var student 
    = new {firstname="xu", lastname="minghui", age=36};
            System.Console.WriteLine(
    "\n{0} {1},今年{2}岁。",
                student.firstname, student.lastname, student.age);
        }
    };
  • 相关阅读:
    第一个django
    windows安装django
    Uva 705
    UVa 10034
    ACM中出现RuntimeError的原因及可能的解决办法
    [转载]最小生成树-Prim算法和Kruskal算法
    Uva 10305 Ordering Tasks
    Uva 793 Network Connections
    Uva 10608 Friends
    Uva 10583 Ubiquitous Religions
  • 原文地址:https://www.cnblogs.com/flaaash/p/981231.html
Copyright © 2011-2022 走看看