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);
        }
    };
  • 相关阅读:
    css3 练习
    onethink 返回上一页
    小程序之轮播图
    Node 基本使用
    IDEA Terminal
    Spring Shell简单应用
    Spring Theme简单应用
    Spring MVC的学习笔记
    Win10出现键盘未失灵,按下的键都是快捷键的问题
    SQL Server 添加描述
  • 原文地址:https://www.cnblogs.com/flaaash/p/981231.html
Copyright © 2011-2022 走看看