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);
        }
    };
  • 相关阅读:
    IO流操作-图片操作(二)
    SQL Server 大数据量批量插入
    XSS【跨站脚本攻击】
    Log4net配置
    发布网站碰到的问题
    操作百度API
    Html.BeginForm
    jquery自动识别输入的都是数字
    mysql中随机取出几条数据
    Html中截切文章内容,造成标签不全的问题
  • 原文地址:https://www.cnblogs.com/flaaash/p/981231.html
Copyright © 2011-2022 走看看