zoukankan      html  css  js  c++  java
  • C#中数组的使用

    1.for

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace Demo
    {
        class Program
        {
            static void Main(string[] args)
            {
                string[] friendNames = { "张三","李四","王五" };
                int i;
                Console.WriteLine("我有{0}个朋友!",friendNames.Length);
                for (i = 0;i<friendNames.Length;i++)
                {
                    Console.WriteLine(friendNames[i]);
                }
    
                Console.ReadKey();
            }
        }
    }
    
    

    2.foreach

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace Demo
    {
        class Program
        {
            static void Main(string[] args)
            {
                string[] friendNames = { "张三","李四","王五" };
                Console.WriteLine("我有{0}个朋友!",friendNames.Length);
                
                foreach(string friendName in friendNames)
                {
                    Console.WriteLine(friendName);
                }
    
                Console.ReadKey();
            }
        }
    }
    
    
  • 相关阅读:
    区域赛
    kd树的创建和求最近邻
    Fliptile POJ
    第六周作业
    第四次作业
    第三次作业
    第二周作业
    第一次作业
    董雅洁 我的第0次作业
    21 UI_布局 之 线性布局 xml配置方式
  • 原文地址:https://www.cnblogs.com/jiqing9006/p/6728651.html
Copyright © 2011-2022 走看看